Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: LarryChen

Page 1 of 40 1 2 3 4

Search: Search took 0.05 seconds.

  1. Replies
    13
    Views
    481

    Re: A question regarding creating a window

    It turns out the first argument of CreateDialog wasn't set up properly. Now I am able to create the dialog. But modeless dialog is not a solution. Basically in order to display the dialog all the...
  2. Replies
    13
    Views
    481

    Re: A question regarding creating a window

    Yes. Is there other things I should be aware of? Thanks.
  3. Replies
    13
    Views
    481

    Re: A question regarding creating a window

    Thanks for your replies. I think the problem is that when I called CreateDialog, it returns NULL handle because of the error ERROR_RESOURCE_TYPE_NOT_FOUND. I already included the dialog template in...
  4. Replies
    13
    Views
    481

    Re: A question regarding creating a window

    Ok, I created a modoless dialog,


    HWND g_hDlg = NULL;

    g_hDlg = CreateDialogA(NULL, MAKEINTRESOURCEA(IDD_MYDLG), NULL, (DLGPROC)DlgProc);

    DWORD ret = GetLastError();
    char s[64];
  5. Replies
    13
    Views
    481

    A question regarding creating a window

    This is a typical way to create a window,


    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    switch(msg)
    {
    case WM_CLOSE:
    ...
  6. Re: Is there any way to change the background color of a messagebox?

    Even I return TRUE in processing WM_ERASEBKGND, it still doesn't work. The window looks transparent but I expect it to be red. What went wrong? Thanks.
  7. Re: Is there any way to change the background color of a messagebox?

    SO I changed the code,



    LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    HDC hdc;

    switch (uMsg)
    {
  8. Re: Is there any way to change the background color of a messagebox?

    Now I created my own custom window and then within window procedure I tried to process the window message WM_ERASEBKGND, here is the code,


    LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg,...
  9. Re: Is there any way to change the background color of a messagebox?

    Yes, it succeeds. Actually I can make use of the callback function CallWndRetProc to change the position of the dialog but I can't change the color of the dialog within the same callback function...
  10. Re: Is there any way to change the background color of a messagebox?

    The call to SetWindowHookEx and the call to the callback function CallWndRetProc are in the same process.
  11. Is there any way to change the background color of a messagebox?

    Here is what I did,


    oldHook = ::SetWindowsHookEx(WH_CALLWNDPROCRET, CallWndRetProc, NULL, ::GetCurrentThreadId());

    MessageBox(...);

    UnhookWindowsHookEx(oldHook);

    Then within the...
  12. Replies
    3
    Views
    540

    A question regarding a debug error.

    Here is the code,


    void MergeArray(int arr[], int l, int m, int r)
    {
    int* b = new int[r-1+1];

    int i, j;

    int index = 0;
  13. Any guru here can explain rules in celluar automata?

    There is too many rules in cellular automata. So is it possible to explain all the rules altogether? Thanks.
  14. Re: How to terminate a thread from outside properly?

    If I write a multi-threaded program like this,


    class CFoo
    {
    public:
    CFoo();
    ~CFoo();

    private:
  15. Re: How to terminate a thread from outside properly?

    I understand this part. What I don't understand is that why you put scoping block before return statement since without this scoping block when the function main is finished, then the destructor of...
  16. Re: How to terminate a thread from outside properly?

    I realize that a thread doesn't have to sleep in order for another thread to execute based on my debugging. However, I don't understand that without calling sleep, how can one thread "yields" its...
  17. Re: How to terminate a thread from outside properly?

    Actually I don't understand why you added the scoping block to the main function. Would you explain it a little bit? Thanks.
  18. Re: How to terminate a thread from outside properly?

    Sorry to make you confused and forget about what I said before. If the function main is like this,


    int main()
    {
    CFoo foo;
    //Sleep(5000);

    return 0;
    }
  19. Re: How to terminate a thread from outside properly?

    Thanks for the example. This piece of code actually is not my code. I wonder why we need a wait event here? I think a stop event is good enough to terminate a worker thread. Thanks.
  20. Re: How to terminate a thread from outside properly?

    The main thread gets executed first and then another thread gets executed. But at this time, the stop event is non-signaled and so the main thread never gets a chance to be executed. Therefore main...
  21. Replies
    26
    Views
    2,035

    Re: A question regarding double-checked locking

    So you meant when I run the statement static Singleton instance first time, then instance is created. But when I run the statement static Singleton instance second time, it does nothing? Thanks.
  22. Re: How to terminate a thread from outside properly?

    My question is actually related to how to design the main function so that the program can switch between the thread and main thread elegantly. If you call StopThread in the main thread as you...
  23. Replies
    26
    Views
    2,035

    Re: A question regarding double-checked locking

    Thanks fo r the explanation. in this simple implementation,


    Singleton& Singleton::getInstance() {
    static Singleton instance;
    return instance;
    }

    When we call getInstance first...
  24. How to terminate a thread from outside properly?

    Here is the code,


    /* I normally end a thread by returning from the Thread function or calling ExitThread within the thread function. To close a thread from outside we can use wait and signal...
  25. Replies
    26
    Views
    2,035

    Re: A question regarding double-checked locking

    Thanks for your reply. How is thread-safe achieved in static initialization with a compliant c++ implementation without using any synchronization object explicitly?
Results 1 to 25 of 980
Page 1 of 40 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center