get me the logic of this code pls !!!!!!!!!!!!! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

get me the logic of this code pls !!!!!!!!!!!!!

hello friends , i am new to api programming , i am trying to do a notepad program.
in that prog . i creates the parent window using thw api -
hparentwindow = CreateWindowEx(.................);
i am using this to get the parent window. Only when i use ShowWindow()
api i can see the window.during WM_CREATE message processing i have created a child window of type EDIT using the same
function hedit = CreateWindow(..."EDIT"................); i can see the edit class window with out calling ShowWindow api , how is this Possible. pls reply thanks




Comments

  • edocecrousedocecrous Posts: 49Member
    Hi!
    First of all, did you use WS_VISIBLE flag in the dwStyle field? If you did, the window should be visible after creation.
    If you did, but also in the callback routine you specified your own messagehandler functions, make sure if you have no routine for something, pass the hwnd,msg,wparam,lparam to the default windows message handler. If you don't, your window will be not drawn, because the default handler is responsible to do that.

    Also, this could help, so I tell you, what happens, when you start up your program /any program/:
    (the numbers represent the sequence, the stuff starting with a long space represents the callback routine)

    1 Definitions,Includes,Globals
    2 WinMain function starts
    3 winclass,RegisterClass,CreateWindow
    4 WinProc - MsgHandler starts up
    5 WM_CREATE executes (get called)
    6 WM_ERASEBKGND executes (get called)
    7 Main Loop (runs 1 cycle)
    8 WM_PAINT (get called)
    9 Main Loop (runs til exit)
    10 WM_CLOSE (get called)
    11 WM_DESTROY (get called)
    12 End WinMain, return to windows

    And your main loop should look like this:
    While(...)
    {
    if (PeekMessage(&msg,NULL,...
    {
    if (msg.message == WM_QUIT) ...
    if (msg.message == WM_KEYDOWN) ...
    .
    .
    .
    }// end of peekmessage
    TranslateMessage(...)
    DispatchMessage(...)
    }//end of while

    Of course, you can use a case seq. instead of the if-s, but my routine used an extensive case seq. to handle the WM_KEYDOWN message, and embeding case sequences are not a good idea...

    Good luck with your program, and don't forget, you can always use breakpoints to find out what your code actually does. :-)
    /it's not walid for DirectX of course.../

    Edocecrous
    (system/game programmer)
    :

Sign In or Register to comment.