my progam works on a win32 console. When i port the same program to smart device ,pocket pc, the program stops on main(). I think main() needs to be changed. Any ideas
so close, yet so far away !!!
This is my last high hurdle, i hope!!! The rest should be minor cleanup.
I rebuilt this machine and nothing changed. I tried using main, wmain, and tmain and the pc locked up at main. I tried changing the entry point, in the configuration fies and the computer locked up at main. I tried resume on main, nothing happened. The problem must be simple, I guess!!!
I read a lot on threads. Main is thread one and starts automatically. Threads can be stopped and started, but i can not get main to start.
By the way, for the score book, GUI is muti-treaded not multi-tasking.
Here is the section of code in question. I never get past main. If i did get past main i would get a beep, "12345", and a screen of data.
int
main(){
x1b=90;
//draw text rect coordinatesx2b=300;
y1b=90;
y2b=300;
messagechar=L
"12345"; //text to drawprintf(
"\a"); //beepWM_PAINT;
read_hotspace_file();
//data fileread_garage_file();
//data filedisplay_screen(); // display 21x7 array
return (0);
}
I rebuilt the machine again, and tried this new code. I deleted all other functions. The system still locks up at main(). I should get "HELLO WORLD" and "12345" on my screen. All i get is "HELLO WORLD."
#include
<stdafx.h>#include
<conio.h>LPCWSTR messagechar = L
"HELLO WORLD ";int
x1b=10;int
x2b=100;int
y1b=10;int
y2b=100;void
main(){
x1b=90;
//draw text rect coordinatesx2b=300;
y1b=90;
y2b=300;
messagechar=L
"12345"; //text to drawWM_PAINT;
}This is the complete program. Main is a thread, that automatically runs from the start Can i configure the system, to make this program work
so very close, too too far away !!!!
Help,says to use "INVALIDATE". Except it does not work!!! If i use InValidateRgn(hWnd,NULL,FALSE), I can get "HELLO WORLD" to flicker, but I can not get to main().
If i write my c++ command function in the windows engine. I get my 21x7 screen. the function is as follows:
for(y=0;y<=7;y++){ for(x=1;x<=21;x++){x1b=(x-1)*characterwidthb;
x2b=x*characterwidthb;
y1b=(y-1)*characterheightb;
y2b=y*characterheightb;
SetRect(&rc,x1b,y1b,x2b,y2b);
DrawText(hdc,messagechar,1,&rc,DT_LEFT|DT_TOP);
}}
AM I BETA TESTING STILL I can try to move my whole c++ command sequence into the windows engine, except the engine does not accept primative codeing.
Is there a work around for main
this is what i call a block. I can not find a way around it.
for next loops are blocks. While statements are irratic blocks. SetCursorPos, font.DrawText, InValidate, and ProcessCmdKey will not work correctly, they r blocked. BLOCKS!!!! They are not bugs. Bugs have no systemmatic signatures. BLOCKS r not bugs. What is funny, is, i nested two for next loops in the windows engine and they worked like a champ. I want to move my whole program in there. It works.
Ive gone threw my whole program now, at least five times. I found all the blocks, and nothing will work !!! It works great in c, yea. It bombs out here in mvs8. I can not think of anything else to do to it. My unresolved symbols all work now.
The boss says i have four weeks to make it work, or he is pulling the plug and Im a dummy. Right now I am smart !!!
So, i ask you, r there work arounds for the blocks i have, or can u or i set the configuration tables and have the beta2 test end. Then i can test the software to see if it works without the beta blocks. That is what we did in word and c++. I feel really confident in msv8. I think it will be a great product once all the good people have tested their software. And i feel great to be part of it !!!
I need to use THREADSTART to get my c++ program to run. Right now i have an singular system, untill i start the c++ thread!!!!
I can not stop winmain(), in order to start main(). Winmain is the primary function which runs on startup. It seems that main() is waiting to be started by the start() function. I can not figure out why, or which functions to call, because all the functions i have used are managed.
I keep searching for unmanaged code, and i keep getting suggestions for managed code. Unmanaged code uses '.h' files. While manage code uses ' #using'.
According to the laws of c/c++, main() is already a thread and should be running !!! So i try to start a thread that, by law, is already running, and no errors occur!!! The next idea is to rebuild from scratch. I've done that 20 times and main() still does not run. My nephew suggested i play with the project settings under threads. I'll try his suggestion
END OF PROJECT, IF MAIN DOES NOT RUN .........
CAN YOU FIX IT
i could use a gotoxy() function in the console mode.
I heard that there is only one entry point, which would be WinMain(). Main() is not an entry point. To run my c++ program i must create a thread and then it will run. Something like this, i think:
LPTHREAD_START_ROUTINE YESSSS();
void
mainbegin(){CreateThread(NULL,NULL,YESSSS(),0,0,NULL);
}
LPTHREAD_START_ROUTINE YESSSS()
{
x1b=50;
x2b=100;
y1b=50;
y2b=100;
messagechar=L
"REAL WORLD";printf(
"\a");WM_PAINT;
}
I can not figure where to put the CreateThread function call.
I found gold, yes,yes,yes. I got my c++ program to run as a thread !!!!! It is working, finally. I hate to say what nonsense i was thinking. I got my thread message "REAL WORLD" to display, and part of my database to display. Seven months ago, i did not know anything about Pocket PC and now i have a program, Through tons of reading. I figured it out with the help of my good friends at microsoft, and learned more than i thought i would ever need.
what a mess this thread is !!!!
Now the sip, keyboard !!!!!!!!
OUCH !!!! ....
I had my program working and debugging for about five hours, making good progress. Boy that felt really good. I could see the light at the end of the tunnel !!!!Then something happened to the compiler and now nothing works like it should. Is this a common event in mvs8, because i have not changed anything.
I CAUGHT A BUG, IT IS CALLED "PHOTOGALLERY HP" It is sneaky, you can use task manager to get of it, but it shows back up when you start the computer. It stays dorment utill some odd reason it feels like deleting an icon, or a line of code in a project. It is a real bugger to find.It pretends to load a file with "WINDOWS INSTALLER" and then seeks out stuff in it's list to delete. I may need help chasing it down, now that it attacked my program. If you see the bug report it to norton security center.
i believe no matter what i do, i can not find this problem. I am not going to give up looking, but i think your input at this point, would be greatly accepted. I know what the problem is, that is, the function call to CreateThread, is not enabled.
So close and not far away......
this program looks like it should still work, it worked for five hours then it stopped.
int
mainbegins(){ windows engine if(checkstartupflag == 0){StartMainThread();}
return 8;}
int
StartMainThread(){ c++ programCreateThread(NULL,0,YESSS(),0,0,NULL);
ResumeThread(YESSS());
checkstartupflag = 39;
return
29;}
StartMainThread is never activated, this is my main thread. It was active once for five hours. Now i can not get it to do anything.
11-16-06 a day of rest, I think i will take a couple of days off, until something happens in GUI world.
11-18-06 i think i will convert to c#, except i will still have the same gui problem. Another day of rest.
11-24-06 Checking for GUI. converted 1/2 c++ file to c#. Interesting. Tested GUI. GUI still does not work. Another check.
11-26-06 Tested GUI myway, herway, thatway, hisway, and got noway. Pretty sure it is the GUI.
11-28-06 I am going to try c++ and c# to get this program to work.
11-28-06 right now i prefer c++, C# is very wordy like ADA, but i can see how it can be prefered, with self explanation. i need more time in c#, but right now i need c++ ppc to work. Going the C# route may take up to six months. The BOSS gave me three more months, not enough time. BURN OUT !!!!!!
12-05-06 converting to C# going well. I figured my GUI out. It is working. YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS. Now i need to figure how to put a character on the screen.
Best to be wordy in C#, and get rid of all your C++ functions.
12-11-06 GUI still not working. Got 3 buttons, and one textbox. Need to put my string into the text box
3:44 The GUI stopped again and now i get random calls. helppppppp.
12-06-06 My GUI will not even call my thread. Well i am lost as what to do...
12-07-06 C# compiled, GUI still does not work. 600 lines c++, 1100 lines C#. It seems hopeless, not to get anywhere.
12-08-06 C# compiles without a char keyboard input. GUI does not work..
12-13-06 GUI still does not work. C# compiles for windows application, can not get the TextBox to display characters on a grid. C# does not compile for console applications. It seems most of the important features are blocked. What can i do to free GUI
12-14-06 GUI still not working. C# windows console compiles, does not display data. So far, C++ win32 project,C++ console application,C++win32 smart device project, C# application console, C# windows application, C# device application are sooooo close, yet so far away. Next i will try basic to see if it will work.
12-15-06 Gui still not working. None of the 6 source files work.
12-15-06 Gui still the same. Got C# windows to display string, not working right. Can not figure out the blocks in these file. I am learning C# (drawString), buttons, and text box. Lots of info in help. It seems mvs8 was meant for C#.
12-17-06 GUI not working. C#,windows, got string table to display in windows.
12-19-06 GUI not working, going to give my computer a rebuild. C#, got string table to display in Windows, YESSSSSSSSSSSSSSSSS. Now i will read a text file, build a database and see if it displays the file.
12-20-06 Gui still the same. C# ,i read a file in, made a database, but can not fill a screen with database of char.
Well, that's all FOLKS. I can only get bits and pieces of C++ and C# to work. My best bet is Pocket pc and c++. I can not get anything to fully work. All i can say, is, when does the next release come out. Through it all i learned gui, and c#.
12-21-06 Im Back. In the six of my programs, there is a block on (StreamReader, StreamWriter,) file read & write, keyboard read, and screen write functions. They r blocks. I can not write around them, and they do not work. r there any patches coming out, soon.
2-22-06 Every day is ten hours of programming, since 4-1-06. My six programs have 4 main blocks each + some other pescky little problems not related to the main block!!!!!!!!!!!!!!!!!!! Im sure someone has an operational unit. I need to get a copy of the fully operational unit. I have high hopes my ZL1800 LPI system will work now, but so Syblime
GUI still does not function. It is soooooooooooooooooooooo close, and a micron, soooooooooooooooooooooooooooo far away.
12-23-06 gui does not work, my six programs do not work. the boss has given up on mvs 2005. he is pulling out. maybe i should stick around and let him go. I told him all that was wrong was the six blocks, but refuses to back us anymore. I told him microsoft could easily bypass the blocks, but he insisted to have it his way. new job time !!!!!
12-25-06 gui not working, programs not working. MERRY CHRISTMAS.
12-26-06 gui and programs not working. HAPPY 1ST DAY AFTER CHRISTMAS. Is there a method to talk to an engineer to help resolve my blocks
I do not understand why my software's blocks are activated, since i am not a beta tester. I am not a beta tester, but my software acts as if it were being beta tested
12-28-06 gui still not working. So i took my ppc software and made a c++, smart device, win 32 project. And i got to my thread. Now i am not able to paint to the screen. The software is thus:
void
StartThread(){checkstartupflag = 39;
for
(xpos=0;xpos<=100;xpos++){}if
(CreateThread(NULL,0,YESSS(),0,0,NULL) == NULL){checkstartupflag = 100;};x1b=0;
x2b=100;
y1b=60;
y2b=80;
messagechar=L
"START THREAD BEGIN";for
(xpos=0;xpos<=100;xpos++){}UpdateWindow(hWnd);
for
(xpos=0;xpos<=100;xpos++){}WM_PAINT;
}
The program will not paint messagechar. Well, back to the drawing board.
12-29-06 gui still does not work, I can not get to my main thread to display messages. My c++, smart device, win32 project gets to the main thread, but will not display any messages. Am i displaying my message correctly.
C++ INTERFACE TO WINDOWS ENGINE:
void
putchh(char putchhh){x1b=(3+x-1)*characterwidthb;
x2b=(3+x)*characterwidthb;
y1b=(2+y-1)*characterheightb;
y2b=(2+y)*characterheightb;
puttting = putchhh;
// display_screen = &puttting;
messagechar = L
"X"; for(xpos=0;xpos<=10;xpos++){}UpdateWindow(hWnd);
WM_PAINT;
WINDOWS ENGINE:
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
RECT rc;
SetTextColor(hdc,COLORREF RGB(000,000,000));
SetBkColor(hdc,COLORREF RGB(255,255,255));
GetClientRect(hWnd, &rc);
SetRect(&rc,x1b,y1b,x2b,y2b);
DrawText(hdc,messagechar,15,&rc,DT_LEFT|DT_TOP);
if(checkstartupflag == 39){SetRect(&rc,0,80,100,100);
DrawText(hdc,TEXT(
"THREAD START"),12,&rc,DT_LEFT|DT_TOP);}
if(checkstartupflag == 100){SetRect(&rc,0,100,100,120);
DrawText(hdc,TEXT(
"THREAD FAIL"),11,&rc,DT_LEFT|DT_TOP);}
if(checkstartupflag == 0){ void StartThread();}
12-30-06 GUI not operational, unable to display characters in win32 project.
1-1-07 GUI does not work. I am converting a 9000 line c++ file to win32 and it does not display characters with _putch. all my other six programs do not display characters.
1-2-07 gui does not work. The gui stops when it goes to c++ and executes the CreateThread function. The c++ program stops on the same statement. Through all the combinations in the createthread function, the gui and c++ stop, and can not be started again.
I do not know much about the compiler options, but i am begining to think that is where the problems lye. Can u check my compiler options and set them to a state that works
Is there a release of a msv8 unit that works, i would like to get a copy.
1-3-07 GUI still not working............
C++ Win32 Console
C++ Win32 Win32 Project
C++ Smart Device Win32 Project
C# Windows Device Application
C# Windows Console Application
C# Windows Windows Application
C# Smart Device Device Application
These r the projects i currently have. None of them work and all are based on my screen handler which has been operational for ten years. All fail in a simular manner, Basically at CreateTread, read file, write file, putch, graphics, Console read, Console write, getch, SetCursorPosition. Each project handles the software in a diferent manner except they fail at input from screen, output to screen, reading a file, writing a file, and CreateThread for ppc.
I am basically stuck on all files, because i can not get arround these blocks. I like mvs8, except i have come to a standstill. I am waiting now for your feedback on how to alieviate the blockage.
1-4-07 gui still not working. This mvs8 programming gets real easy once you know the steps. All i need r the blocks to be removed. Otherwise I am stuck here spinning my wheels.
1-5-07 gui not workng. waiting. tell me msv8 is not broken. i am waiting for the go and proceed sign. once the pieces fall into place, mvs8 becomes quite clear.
to check mu gui, i took my c++,smart device,ppc and ported it to a c++, win32, win32 project and got the same results.
1-6-07 gui not working, its working, its not working, its working, its not working, its working, its not working, its working, its not working.
well how do you make it work, it does not work for me
1-7-07 gui not working. is there a new release of mvs8 or a patch coming out soon.
my progressbar control in c++,smart device,ppc does not work either.
createthread does not work in any project.
gotoxy in console does not work.
1-8-07 gui not working.
1-9-07 gui not working.
WM_PAINT not working.
UpDateWindow not working,
1-10-07 gui not working, i reloaded mvs8, and all remained the same.
1-13-07 gui not working. Not IN yet !!! That stuff was for your eyes only ,fyeo. Or who ever.
I do not understand the criteria, to activate CreateThread. This a real bummer, because, if i do not get CreateThread activated, 600 hundred days of programming is pooh. LOL hehe. No one else offers the pocket pc package like microsoft. i really wish i could get mvs8 to work !!!!
1-14-07 give me a break, gui not working. All i want to do is put a screen handler on the pocket pc. I was this far in April. gui did not work then either. Seems like you do not want me to have the compiler. Other people in "ask a question" are far ahead of me.
I can not do anything, downstream of my "CreateThread". If you r reading this, as I am sure you must, do you know how to fix CreateThread
1-15-07 gui not working. What do u need from me to activate CreateThread
1-16-07 gui not working. snowed in. Can u refer me to a version of mvs8 that works. I am sure this version works, except not for me. There must be a reason my copy has all these locks and blocks. I am sure of this!!!
1-18-07 gui tested, not working.
1-19-07 gui tested, not working.
1-20-07 gui tested, not working.
1-21-07 gui tested. not working.
1-22-07 gui tested. not working.
1-23-07 gui tested. not working.
1-24-07 gui tested. not working.
1-25-07 gui tested. not working.
1-26-07 gui tested. not working.
c++, win32, win32. Tried making a progress bar. not working
#include
<stdafx.h>#include
<commctrl.h>#include
<winuser.h>#include
<winbase.h>#include
<windows.h>extern
HINSTANCE g_hinst;void
StartThread();int
repeat=0;LPTHREAD_START_ROUTINE YESSS();
void
StartThread(){repeat=1;
CreateThread(NULL,150000,YESSS(),0,0,NULL);
}
LPTHREAD_START_ROUTINE YESSS()
{
//BOOL ParseALargeFile(HWND hwndParent, LPSTR lpszFileName)
//{
RECT rcClient;
// Client area of parent window int cyVScroll; // Height of scroll bar arrowHWND hwndPB;
// Handle of progress barHWND hwndParent;
GetClientRect(hwndParent, &rcClient);
cyVScroll = GetSystemMetrics(SM_CYVSCROLL);
hwndPB = CreateWindowEx(0, PROGRESS_CLASS,
(LPCWSTR) NULL, WS_CHILD | WS_VISIBLE,
rcClient.left, rcClient.bottom,
cyVScroll, cyVScroll,
hwndParent, (HMENU) 0, g_hinst, NULL);
SendMessage(hwndPB, PBM_SETRANGE, 0, MAKELPARAM(0, 7500));
SendMessage(hwndPB, PBM_SETSTEP, (WPARAM) 1, 0);
SendMessage(hwndPB, PBM_STEPIT, 0, 0);
return 0;}
NOTE: IF YOU USE THE DEBUGGER, WITH CREATETHREAD YOUR RESULTS WILL COME IN FASTER ANS BETTER. ONCE I USED THE DEBUGGER I COULD EASILY UNDERSTAND THREADING.

Pocket Pc Stops
Shawnk
Got a call into microsoft. This is the solution for my program stopping on CreateThread, and it works!!!!!!
void
StartThread(){DWORD dw = 0;
threadID =&dw;
if
(YESSSSIR = CreateThread(NULL,150000,YESSS,NULL,0,threadID)== NULL){checkstartupflag = 100;};checkstartupflag = 39;
checkstartupflag = checkstartupflag;
}
//LPTHREAD_START_ROUTINE YESSS()
DWORD WINAPI YESSS(LPVOID lpParameter){
x1b=0;
Now i have two threads, Windows Winmain and YESSS, and the debugger runs through the two program threads correctly. Next is to get UpdateWindow to send a WM_PAINT message to Winmain.
Be sure to use the Debugger so you can see the program sequence.
Sergei Dorogin
To refresh the pocket pc's screen, you need to send a the WM_PAINT message to the handheld. this is done like this
Postmessage(g_hWnd,WM_PAINT,NULL,NULL);
this tells the pocket pc to paint the window and jumps back to your cpp program.
Sendmessage(g_hWnd,WM_PAINT,NULL,NULL);
this tells the pocket pc to paint the window and waits till the paint is done, then,jumps back to your cpp program.
#1.
Large,small items that need to be included:
At the beginning of your windows program, in golbal variables declare:
HWND g_hWND;
// Global Variables:
HINSTANCE g_hInst;
// current instanceHWND g_hWndMenuBar;
// menu bar handleHWND g_hWnd;
// post message so postmessage can find WM_PAINT#2.
At the end of CreateWindow in your windows program, declare:
g_hWnd = hWnd;
if (!MyRegisterClass(hInstance, szWindowClass)){
return FALSE;}
hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
if (!hWnd){
return FALSE;}
g_hWnd = hWnd;
so postmessage can find WM_PAINT
#3.
At the beginning of your c++ program, declare:
extern HWND g_hWnd;
DCollins
ONE LAST
YESssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss