ppc stops on main()

i am using vc++, with a smart device, to program a ppc. My problem is the windows engine runs just fine, but it runs all the time, without timeshare to my main() vc++ program. Winmain() and Main() are my only threads, both are suppose to start running at time "0". Main () does not startup and i can not thaw it. This has been a problem for 4 months. I can not program around main().

I would appreciate any help and input.




Answer this question

ppc stops on main()

  • pc_83

    Thanks, It worked. I did not check "19" input.

    Thanks again, again, and again ................



  • nobugz

    that information is very useful. thanks a ton full.

     

    This is what i came up with. I'm pretty sure it works, and i'm facing a config problem somewhere.

    // 1111.cpp : Defines the entry point for the application 

    #include "stdafx.h"

    #include "1111.h"

    #include <windows.h>

    #include <commctrl.h>

     

    extern int x1b;

    extern int x2b;

    extern int y1b;

    extern int y2b;

     

    extern LPCWSTR messagechar;

    extern int mainbegin();             //EXTERN TO FIND CREATETHREAD

     

     

    #define MAX_LOADSTRING 100

    // Global Variables:

    HINSTANCE g_hInst;

    HWND g_hWndMenuBar;

    // Forward declarations of functions included in this code module:

    ATOM MyRegisterClass(HINSTANCE, LPTSTR);

    BOOL InitInstance(HINSTANCE, int);

    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

    INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);

     

    int mainbegins(){                     // START  CREATETHREAD SEQUENCE

    if(mainbegin() != 19){                 //COMPARE 19 TO VALUE FROM C++

                                                   //TO AVOID LOOPING

    mainbegin();}                            //GOTO CREATETHREAD

    return 8;}

    int WINAPI WinMain(HINSTANCE hInstance,    // WINDOWS WINMAIN

    HINSTANCE hPrevInstance,                             // RUNS WELL

    LPTSTR lpCmdLine,

    int nCmdShow)

    {

     

     

                                                                        //MY C++ FILE

    void _putcher(char putches);

    void _printers(char putstr[21]);

    void SetCursorPost(int x ,int y);

    char _getcht();

    int mainbegin();                                               //DECLARING MAINBEGIN()

    LPTHREAD_START_ROUTINE YESSSS();       //DECLARING YESSSS()

     

    int mainbegin(){                                                //MAINBEGIN

    CreateThread(NULL,100000,YESSSS(),0,0,NULL); //CREATING YESSSS() THREAD

    return 19;                                                        //NO LOOPS

    }

     

    LPTHREAD_START_ROUTINE YESSSS()         //ENTER YESSSS() THREAD

    {

    x1b=50;                                                          //I NEVER GET HERE

    x2b=100;

    y1b=50;

    y2b=100;

    messagechar=L"REAL WORLD";

    WM_PAINT;

     

    I believe i am not looping on mainbegin(). My windows thread works well.

    I call mainbegin from the windows engine on the first loop. I bybass it

    on the second loop, and the third, and the forth..... and so on.

    I createthread YESSSS(), so i should get "REAL WORLD", but i never get there.

    I believe I am not setting a flag in the configuation, like "entry point".



  • mgee16

    No, you Main() is not supposed to "start at time "0"". There's only one entry point which starts and only one initial thread. You have to create another thread(s) in your code as needed.



  • ppc stops on main()