Hello, i have a PropertySheet with PropertyPages. If there is no button in a page the "OK"-button of the sheet is the default button. Otherwise the first button in the page will automatically become the default button (none of the buttons in the page has the def-btn-style). My client want me to set always the "OK"-button of the sheet as default button. So i tried SetDefID(IDOK) in the OnInitDialog-handler of the page. But it had no effect. Is there an easy way to prevent the default behavior of the sheet or must i overwrite the WndProc() of the sheet or page and catch the message where the first button in the page is set do default? Best regards, Tabor25
tabor25
Posts
-
CPropertyPage and default button behavior -
MFC-App and Hyper-ThreadingHello, maybe this can be of interest for someone: my multi-threading mfc-app crashed sometimes not reproducable on systems with hyper-threading active. So it would be very nice if i could tell my app to use only one cpu even if hyper-threading is active. After searching msdn and the internet for a method to do this, i found this api-function: SetProcessAffinityMask(GetCurrentProcess(), 1); The first parameter is the handle to the current process (my app) and the second parameter is a 32-bit value (mask) where every bit represents a cpu. Calling this function solved the problem of my hardly to reproduce exceptions. Of course it does not fix the problem at the root because my app isn't HT-compatible at least, but now i have more time to learn about the difference between using HT and not using HT. Maybe someone knows a good starting-point for this. Best regards, Tabor25
-
Showing properties of MULTIPLE filesHallo David, the code looks like this: CString file = ""; POSITION pos = m_fileList.GetFirstSelectedItemPosition(); if (pos) { file = m_fileTree.GetPath() + m_fileList.GetItemText(m_fileList.GetNextSelectedItem(pos), 0) + '\0'; } if (file.GetLength()) { SHELLEXECUTEINFO a_stInfo; memset( &a_stInfo, 0, sizeof( a_stInfo ) ); a_stInfo.cbSize = sizeof( a_stInfo ); a_stInfo.lpVerb = _T("properties"); a_stInfo.lpFile = _T(file); a_stInfo.fMask = SEE_MASK_INVOKEIDLIST; ShellExecuteEx( &a_stInfo ); } The member lpFile of the structure seems to carry only one filename. I tried to separate all selected files by using semicolon or \0 but without success. So at the moment i will show only the properties of the first selected file. Maybe you or someone else has an idea... Best regards Tabor25
-
Showing properties of MULTIPLE filesHello, when you select more than one file in the windows-explorer you can show the properties by right-clicking and choosing the item "Properties" in the shell-menu. I need to be able to do this within my application. I use the ShellExecuteEx-function to accomplish this task. But the problem is that i can only show the properties for the first selected file. I did a google-search and tried also msdn. Maybe someone has an idee. Best regards Tabor25
-
Hiding a CPropertyPage at runtimeThank you very much, i will check this! Best regards Tabor
-
Hiding a CPropertyPage at runtimeHello, I need to know how to hide a CPropertyPage at runtime in my app. I thought that it could be done by first removing all the pages while (m_sheet.GetPageCount()) { m_sheet.RemovePage(0); } and than adding the pages (except the one i want to hide) to the sheet again m_sheet.AddPage(&m_tree, 0); m_sheet.AddPage(&m_calculate,7); m_sheet.AddPage(&m_cad,12); The problem is that removing a page in the way i did will destroy the page and adding the page will recreate it. But I need to hold the state of the page furthermore. Maybe someone has an idea! Best regards, Tabor
-
Owner drawn popup menu and its borderThank you very much :)!!! I will check the article! Best regards Tabor25
-
Owner drawn popup menu and its borderHello, i have a problem with creating a completely owner drawn popup menu, because i cannot manipulate the border of it. Painting the menu-items in the way i want works fine. But the common 3d border will be drawn under Win2k always. I searched in all menu-articles and in the message board. Also i did a google- and msdn-search. I don't know how to paint my own menu-border at all :-( ?! Please help!
-
How to enable/disable menu items in a dialog-based app?Thank you very much for answering to my question. I read the recommended article and added a menu to the demo-project including a test-item. Then i added a UI notification-handler for the menu-item to the dialog-class (where the ui-handler for the button is located), but in case of disabled the menu-item would not be drawn in grey color. I don't know what to do! Best regards tabor25
-
How to enable/disable menu items in a dialog-based app?Hello people, i am working on a dialog-based mfc app. I added a member-variable of type CMenu to the CDialog-derived class, so that a menu is available. I use the ON_UPDATE_COMMAND_UI makro in the message-map of the Dialog to enable/disable menu-items. But the corresponding menu-item isn't drawn in grey color as expected when it is disabled. Why? Does someone has a clue how i can fix this? Best regards tabor25
-
Access to the system image listHello, i have to get access to the system image list. In MFC i used the SHGetFileInfo-methode to get a handle to the system image list. I need it to display files and their corresponding icon in a listview. What methode can i use in .NET framework c++ ? Maybe someone can help me. Best regards tabor25
-
CStdioFile and Seek-MethodHello Kuphryn, ReadString() overwrites the previous data in the Cstring object. Best regards tabor25
-
CStdioFile and Seek-MethodHello, i am using a CStdioFile object to read in a text-file. On some positions within the file i have to seek. I do it like this: CString line; CStdioFile file; ... /* Read a few lines */ while (condition) { file.ReadString(line) /* do something with line */ } /* Save current start-position for new line */ DWORD pos = file.GetPosition(); /* Read a few lines */ while (condition) { file.ReadString(line) /* do something with line */ } /* Go back to saved position */ file.Seek(pos,CFile::begin); Positioning the file-pointer by using the seek-method works only correct, if every line has a 0A 0D at the end. Now i have to parse a file that only has 0A at the end and the seek-method fails. It sets the file-pointer to the middle of a line and not to the beginning of the expected line. Please help! Best regards tabor25
-
Problem with OnToolbarDropDownHello, i need to realize a dropdown-button within a toolbar by using mfc70. I added the extended style TBSTYLE_EX_DRAWDARROWS to the toolbar and also i modified the style of the corresponding button (TBSTYLE_DROPDOWN). Clicking on the arrow will call the message-handler i defined in the following way : afx_msg void OnToolbarDropDown(NMHDR* pnmh, LRESULT* plRes); The message-map-entry is the following : ON_NOTIFY(TBN_DROPDOWN, AFX_IDW_TOOLBAR, OnToolbarDropDown) In the msdn-description the NMHDR-structure is defined as typedef struct tagNMHDR { HWND hwndFrom; UINT idFrom; UINT code; } NMHDR; I thought that i could read the idFrom-value to determine the resource-ID of the button where the arrow was clicked. But for different dropdown-buttons the value is always the same and it matches to no button-ID available! So how can i determine the id of the corresponding dropdown-button by using the NMHDR-structure instead of the NMTOOLBAR-structure (used in vc60)? Best regards tabor25
-
[OT] Determine the compiler-versionThank you very much, Oliver. I will use the online-help to figure out the rest. Best regards tabor25
-
[OT] Determine the compiler-versionHello, maybe this is a little off-topic, but i don't know where to post this problem - sorry. I need to determine if my source-code is compiled by vc60 or .net, because i have to include different header-files depending on the compiler-version. I want to do it in a way like this : #ifdef _VC60 #include <..\src\afximpl.h> #else #include <..\src\mfc\afximpl.h> #endif I think that there must exist a global constant or variable that describes the compiler-version. But what is the name of this constant or variable (it's not _VC60 ;-) ). Best regards tabor25
-
Recieving rate of exchange for securitypapers from the internetHello, i have to write an activex-control, that can recieve the rate of exchange for a securitypaper from a server in the internet. But at this time i have no idea how to access a server and how to recieve the information. Has anyone out there an idea or can give me a link to a description how to do this. Help would be very appreciated. Best regards tabor25
-
User-rights on winntHello, exists there an api-function in c++ that i can use to determine the user-rights of the current user logged in in winnt (i need to know if the user has administrator-rights)? Best regards tabor25
-
Explorer crashes when terminating my mfc-appHello, i wrote an mdi-app with c++/mfc under winnt 4.0. When logging off the current user from winnt, winnt closes all running apps before the login-dialog will be displayed. This works correct for all apps i tested, but when winnt wants to close my app before logging off, the explorer crashes. it seems that the app closes the right way, because no debug-message created by my app is missing in the corresponding debug-file. Where is the difference between closing an app by hand and closing an app automatically by winnt before logging off ? And why can my app cause the explorer to crash ? Please help me, i don't know a way to fix this :confused: Best regards tabor25