Thank you for your reply. I tried it, but somehow I cannot loop through the elements (GetWindow never returns NULL with the GW_HWNDNEXT parameter). I however managed to get it right by using the EnumChildWindows function.
FloatingMarc
Posts
-
How to disable non-visible dialog items -
How to disable non-visible dialog itemsHello, I implemented an expandable/shrinkable dialog (with a "more >>"/"<< Less") button and that works well, except that the dialog items that are not visible can still be accessed and modified (by pressing the Tab key for instance). So I was thinking about simply disabling non-visible items. For that, I don't want to have to specify manually the item ids that need to be disabled when the dialog is shrunk. So I was thinking about going through all items of my dialog and checking whether they are contained in the visible area, then disable them if not visible. What function would I need to use for that? Is there something like: GetDlgItem(index)? Thank you
-
CFrameWnd and CToolBar and tooltips. Should be simple but.. [modified]I have now been strugling since several days, but I can't get my tooltips to show. I have a CFrameWnd that I dynamically create, which contains a CToolBar for which I want tooltips to show up. Here is what I have so far: CFrameWnd creation:
HINSTANCE aa=AfxGetInstanceHandle();
LPCTSTR theClass=AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_OWNDC|CS_DBLCLKS,0,0,LoadIcon(aa,MAKEINTRESOURCE(IDR_MY_ICON)));
MyCFrameWnd->Create(theClass,"MyAppName",WS_TABSTOP|WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS);CToolBar creation (in MyCFrameWnd):
EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM|CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
MyCToolBar=new CToolBar();
MyCToolBar->CreateEx(this,TBSTYLE_FLAT,WS_CHILD|WS_VISIBLE|CBRS_SIZE_DYNAMIC|CBRS_TOP|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|CBRS_TOOLTIPS);//|CBRS_FLYBY );
MyCToolBar->LoadToolBar(IDR_TOOLBAR);
MyCToolBar->SetWindowText("Navigation");
MyCToolBar->EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
MyCToolBar->SetButtons(toolbarStruct(containing command IDs),toolbarItemNb);
MyCToolBar->SetButtonStyle(MyCToolBar->CommandToIndex(TOOLBAR_CMD_1),TBBS_CHECKBOX);
... (similar for the other buttons as above line)
DockControlBar(CMyToolBar,AFX_IDW_DOCKBAR_TOP);Then for every toolbar image in the toolbar editor, I added the tooltip text under "Prompt" (in the properties view). e.g. "hello world\nhello world" Finally, my MyCFrameWnd has a custom message handler (WindowProc) and at the end of that routine I call:
return (CFrameWnd::WindowProc(uMsg,wParam,lParam));
When I look at messages that my toolbar generates/receives (using spy++), I cannot see any WM_NOTIFYFORMAT, WM_NOTIFY or WM_TIMER like other applications showing tooltips. Does anyone have a small clue why my tooltips don't show?
modified on Monday, August 31, 2009 11:44 PM
-
Operating system location (drive letter)Thanks for the information to both of you!
-
Operating system location (drive letter)Hi, Is there a function that will tell me on wich drive the OS (Windows) is installed? I need this to perform a license check because not everyone has its OS installed on the C drive. And related to that: for the license check I use the volume information of the drive. In understand that it is different from the hardware ID of the drive, but how often do people reformat the drive where the OS is installed? I guess it is about as often as a drive would crash (well, maybe a little bit more), so that tells me the volume information check should be good enough for a license check. Am I doing something wrong in my reasoning, or did I forget something? I also understand that the volume id of a drive can be programmatically changed, but has this feature ever been used to override a license check? Any input is appreciated, thanks!
-
CFrameWnd created in dll, child dialogs created in console. How?Hello, I made a dll that exports several functions, 2 of them are: -dllCallCreateWindow -dllCallHandleMessages My console application calls above two functions. Now, in my console application, I want to be able to attach child dialogs to my CFrameWnd. How can I do that? The idea is to have my dll creating a CFrameWnd and running with a default behaviour, but if the user wants to customize the CFrameWnd, he should be able to add child dialogs created by himself in the console application. I can create dialogs in the console application, but I cannot specify the parent window (If I use the CWnd object returned by the dllCallCreateWindow, the application crashes). Any help is greatly appreciated :)
-
Client rectangle not actualized after menu removalHi, In my application I can dynamically create a menu at the top of my window and also dynamically remove it. After I created it, calling "GetClientRect" returns the correct client area (previous area-area occupied by the menu bar). Now when I remove the menu bar, the client area is not updated. Only if I resize the window or move the window will the value returned by "GetClientRect" be updated correctly. How come? Is there a workaround? BTW I remove my menu bar with following code: [source] CMenu* it=GetMenu(); if (it!=NULL) { int nb=it->GetMenuItemCount(); for (int i=0;i<nb;i++)> it->RemoveMenu(0,MF_BYPOSITION); DestroyMenu(it->m_hMenu); } [/source] Or is there a windows function I can call to force a similar behaviour like when resizing the window? Thanks
-
save excel fileTry using the *.csv fileformat. (comma separated values). It is still a text file but can very easily be generated and imported into excel
-
Creating a toolbar in a console applicationHello, I made a dll that has a bunch of functions called from a console application. One of them creates a CFrameWnd window. Inside the function that creates my CFrameWnd, I can create a CToolBar object. However I now want the user of the dll (the creator of the console application) to be able to attach a customized CToolBar object to that window (instead of the default CToolBar object that I created during window creation inside the dll). So I thought I simply create the customized CToolBar object in the client application (console application) in the same way I did in the dll function. That however does not seem to work: in release mode the toolbar appears, but doesn't have any bitmap, in debug mode, I get debug assertion errors because of unexisting resource or instance handles. Following few lines in my console application are impossible to execute without assertion errors in debug mode: CToolBar* toolBar=new CToolBar(); toolBar->CreateEx((CFrameWnd*)dllFunctionGetFrameWnd(),TBSTYLE_FLAT,WS_CHILD|WS_VISIBLE|CBRS_SIZE_DYNAMIC|CBRS_TOP|WS_CLIPCHILDREN|WS_CLIPSIBLINGS); toolBar->LoadToolBar(IDR_TOOLBAR1); toolBar->SetWindowText("Toolbar"); toolBar->EnableDocking(CBRS_ALIGN_TOP); Anyone knows a workaround? Or can anyone propose an alternative solution to my problem?