|
Thanks Blake,
I have no idea why I didn't think of looking at all the members of HELPINFO to find the iCtrlId item. That is exactly what I need, and it works for F1 help as well, so I can trash my previous work around.
Just in case anyone is interested, Brad Robinson replied to my post in the CodeGuru Visual C++ forum with a different solution, he suggested grabbing the Window Handle member of HELPINFO (hItemHandle) and then translating that to a Control ID. That works as well.
Thanks for the assist
Jeff
|
|
|
|
|
Help!!!
I'm tring to create a dialog with the following two lines:
I am string Number 1
I am string number 2
Now, depending on what the user selected beforehand is dependant on which of the above strings is dispplayed on the dialog.
But how do you do it? This is a prelude to more sophisticated dialog, but I need to know how I can change the content of an individual dialog that is dependant on the users selection.
Any help would be great.
Regards
John
|
|
|
|
|
Hi John,
I'm going to guess that you are using the Microsoft Foundation Classes (MFC 6) in the Visual Studio IDE, if this is not true, please specify your environment.
If you go to the 'resources' tab in the 'workspace' you can add a new dialog by right-clicking on the 'dialog' folder in that area and selected 'Insert Dialog'.
By right clicking on the new dialog box you can fill in the 'properties' of this dialog box. Name it something useful such as 'IDD_MAIN_DIALOG' that you will understand later. (using the IDD_ prefix will come in handy later if and when you want to create context sensitive help).
On the dialog put two edit box controls (drag them from the 'controls' tool bar. In the property for each control, fill in the 'id' as something useful like IDC_FIRST_MESSAGE and IDC_SECOND_MESSAGE. (using the prefix of IDC_ comes in handy when you want to have context sensitive help).
You can leave the OK and Cancel buttons there or remove them as necessary.
Now that these edit boxes exist, Save the whole thing. Right click on the dialog box and selected 'Class Wizard'. It will ask you if you want to create a new class, say yes. You will inherit from CDialogBox. Name it something appropriate.
Now when you go back to your 'Class View' tab in the Workspace, you will see that newly added class. You can add a function called OnInitDialog. When the dialog opens, after it is created, but before it is displayed it will run the OnInitDialog() function. You can check parameters here and use the commands 'SetWindowText()' to set up the values in each of the edit boxes before the window opens.
I know this is a quick overview, but it should help to get you started, and as you have more specific questions you should be able to find what you are looking for in the documentation or by posting more specific questions out here.
Hope this helps
Jeff
|
|
|
|
|
Hi all,
been looking at the DIBsection wrapper class of Chris Maunder. Good code but one thing i need is missing: transparent drawing. Anybody have some code (does not have to be usable with the DIBsection wrapper class) that does a fast dib transparent transfer?
Also, from what i read in MSDN, seems there is some support for png files. Anybody have code that loads such a file?
Seems to me (if i read ok) that for fast drawing, working internally with dib is best. Anyone can confirm this?
Thanx a lot in advance
|
|
|
|
|
Made a small class that manages the png (and internally dib) file format.
Also has ability to display png files transparently.
It's all that i wanted so don't bother anymore.
Thanx.
|
|
|
|
|
The following code will give me a dialog box that will allow
a user to choose a directroy.
It does return me the directory name, but I also need the full path to the directory.
How do I get the full path to the directory??????
Thanks in advance.
void CSwapObjectsView::DoDirectoryDialog(CString& strDir)
{
char szDisplayName[MAX_PATH] = "";
char szTitle[] = "Choose a directory";
BROWSEINFO x;
memset(&x, NULL, sizeof(BROWSEINFO));
x.hwndOwner = this->m_hWnd;
x.pszDisplayName = szDisplayName;
x.lpszTitle = szTitle;
x.ulFlags = BIF_RETURNONLYFSDIRS ;
SHBrowseForFolder(&x);
|
|
|
|
|
Here's the bare-bones code to do it. Adding error handling is left as an exercise to the reader.
LPITEMIDLIST pidl;
LPMALLOC pMalloc;
TCHAR szDir[MAX_PATH];
pidl = SHBrowseForFolder(&x);
SHGetPathFromIDList ( pidl, szDir );
SHGetMalloc(&pMalloc);
pMalloc->Free(pidl);
pMalloc->Release();
|
|
|
|
|
I have been trying to display a bitmap on a button when the button is disabled but this does not seem to work. The bitmap is a gray and black image only when the button is disabled. What special things have to be done in order to display a bitmap on a disabled button.
|
|
|
|
|
Somebody knows how to access bits directly in the bitmap without calling GetBitmapBits(GetDIBits) and SetBitmapBits(SetDIBits).
Thanks
|
|
|
|
|
Hi,
I have a dialog with a Slider control that will show the user the number which has been randomly generated. I need to keep generating such value as long as the user doesn't click a button mouse.
I tried to use
// inside my CDialog-derived::OnStart()
MSG msg;
while (!::PeekMessage(&msg,HWND(this),WM_LBUTTONDOWN,WM_MBUTTONUP,PN_NOREMOVE))
{
value = rand() % range;
m_SliderCtrl.SetPost(value);
}
// return from member function
but it didn't work, i can't get the mouse LButtonDown message to stop cycling. Does anyone have a solution?
|
|
|
|
|
How do you make a combo box and list contain the drives and files on the system? Visual Basic has the controls predfined but is there a way to do it in VC with MFC? Thanks in advance.
|
|
|
|
|
I don't use VB, so I don't know what the VB controls look like, but from your description it sounds like you want to use the DlgDirList, DlgDirSelectEx, DlgDirListComboBox, and DlgDirSelectComboBoxEx APIs to fill the controls.
|
|
|
|
|
If I create several modeless dialogs, how do I keep track of what happens in each one of them?
I couldn't find much information on this subject, so I'd really appreciate any help! Does anyone
know some good links or samples on modeless dialogs?
Thanks in advance!
|
|
|
|
|
Could you give a little more info on what you are trying to do ? The message handling routines work the same, whether
in Modal or Modeless. Are you having problems communicating
data between the various modeless dialogs that you have
set up ?
|
|
|
|
|
I don't know how to refer to a certain (open) modeless dialog from my program's
MainFrame, where I create them. I would like to implement reference to a modeless dialog
by checking the dialog's caption and then specifying whether or not the message was supposed to
be sent to that dialog. This raises a question:
Is there a useful function that I could use to check all open dialogs (and their captions)?
If there isn't such a function, is there another way of knowing which (modeless) dialog is supposed
to receive the message?
I don't have to communicate between my program's various modeless dialogs, just send data to them.
|
|
|
|
|
I need to find out the RGB format for the default color of a dialog box under VC++. I tried using GetBkColor but this would always give me a value of (255, 255, 255) which is white. I need this to create a new color under Adobe Photoshop to edit bitmaps that way their background match that of the dialog box or button they will appear on.
|
|
|
|
|
GetSysColor(COLOR_3DFACE) will return the color you want. Don't hard code any particular RGB value. If you do, your UI will look ugly when one of your users changes themes or turns on high contrast mode.
|
|
|
|
|
Thank you very much, now if I can figure out how to properly use Photoshop I will be ok. Once again, thanks for the help.
|
|
|
|
|
Have you tried 193,193,193 ?
|
|
|
|
|
Have you tried (193,193,193) ?
|
|
|
|
|
Two questions pertaining to a tab control:
1) Is there anyway to disable a tab in a tab control?
2) Is there anyway to force the tab to be larger on a tab control?
Any help will be appreciated greatly.
|
|
|
|
|
Hi,
I was wondering if anyone had given the Microsoft MFC Desktop Applications programming exam, and if so, what are their impressions of it ? I'm approaching intermediate proficiency in MFC now. I do understand how everything is laid out, I just haven't had enough experience to know all the quirks and hacks. Plus i'm fairly decent with COM. Would you think it would be a good idea to give it a shot right now, or should I wait much longer ?
Thanks
|
|
|
|
|
When I do painting operations with DirectDraw, the cursor gets painted over. I'm sure I could redraw the cursor, but that seems very un-needed. Right now, the mouse Stuff is from the MFC SDI (no view/doc) framework. Do I need to set up a DirectInput in order to get the cursor to paint automatically?
|
|
|
|
|
IE is documented as supporting IPersistStreamInit, so that given a document (an IHTMLDocument), you can get an IPersistStreamInit for it (by calling QueryInterface), and with that you can read the entire original HTML of the page.
In IE 5.5, it works for the top-level frameset of a page; however, if, using the DOM, I navigate down to a lower-level frame's IHTMLDocument, QueryInterface(IPersistStreamInit) FAILS! It worked fine in IE 5.0.
Suggestions? How can I get an IPersistStreamInit for the frames?
|
|
|
|
|
I've been a programmer for years, but I'm really bad(inexperienced) at VC++ visual components.
I've got a dialog-based app. and I just want to drop a toolbar on it and an ImageList i.e. insert the ActiveX controls, but VC++ creates wrapper classes for them. First of all for the Image List it creates a CImageList1 class which you can't pass to CToolBarCtrl, infact the wrapper for the ToolBar OCX creates CToolBar....I know how to get CToolBarCtrl out of it, but it still doesn't help. I really thought this would be easy.....I was hoping this would be quick, but VC++ makes it really long and often doesn't work.....AM I DOING THIS WRONG?
ANY HELP WOULD BE MUCH APPRECIATED!.
Daniel
|
|
|
|