|
Hi everybody!
I have an exe projekt, and i want to load a child dialog from an dll.
The child dialog should be displayed at the parent dialog in the exe.
The parent dialog knows the rect where the child should be.
PLEASE!!!!
could anyone tell me how it works???
EMail: dawo.office@gmx.net
Thanks and best wishes!!
|
|
|
|
|
Create a regular dll. In dll resource, create your child dialog and specify it's ID. Run class wizard to make a class for your dialog.
Now export your dialog class.
In your exe, import your dialog definition. Use Create member function of your dialog to place it on parent dialog (do not use DoModal member function).
A. Riazi
|
|
|
|
|
Yes, create a Dll, and add in a dialog window and all the necessary stuff as you would for a normal exe. the catch is to add the exported methods (or functions or whatever you call them) to the out side user. here's an example of myddl.h with the exported create call:
//Flags for individual window features
#define SCROLL_VL 0x0001
#define SCROLL_VR 0x0002
#define SCROLL_HT 0x0004
#define SCROLL_HB 0x0008
#define TIC_VL 0x0010
#define TIC_VR 0x0020
#define TIC_HT 0x0040
#define TIC_HB 0x0080
#define STATUS_BAR 0x0100
#define ZOOM_BOX 0x0200
#define ORIGIN 0x0400
#define GRID_LINES 0x0800
//Conglomeration of some standard options
#define STANDARD_SCROLL 0x035A|ORIGIN
#define STANDARD_SCROLL2 SCROLL_VR|SCROLL_HB|TIC_VL|TIC_HB|STATUS_BAR|ZOOM_BOX|ORIGIN
#define STANDARD_VERTSCOPE SCROLL_VR|TIC_VL|TIC_HB|STATUS_BAR|ZOOM_BOX|ORIGIN
#define STANDARD_HORZSCOPE SCROLL_HB|TIC_VL|TIC_HB|STATUS_BAR|ZOOM_BOX|ORIGIN
#define STANDARD_SCROLL3 SCROLL_HB|TIC_VL|TIC_HB|STATUS_BAR|ZOOM_BOX|ORIGIN
//Flags used for cursor styles
#define DASHED_CROSS 0x0001
#define FULL_CROSS 0x0002
#ifdef __cplusplus
#define EXPORT extern "C" __declspec (dllexport)
#else
#define EXPORT __declspec (dllexport)
#endif
EXPORT BOOL CALLBACK CreateDisplay(HWND& hwnd,HINSTANCE hInstance,HWND parent_, int style, bool MDI_child);
Then in mydll.cpp I have this:
//******************************************************//
//Dll Entry point, no initialization needed //
//******************************************************//
int WINAPI DllMain (HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved)
{
return TRUE;
}
EXPORT BOOL CALLBACK CreateDisplay(HWND& hwnd, HINSTANCE hInstance, HWND parent_, int style, bool MDI_child)
{
Display<double,double> *temp =
new Display<double,double>(hInstance,parent_,style,MDI_child);
hwnd = temp->GetHwnd();
the_displays[hwnd] = temp;
temp = NULL;
return TRUE;
}
Now my application uses template classes and my Display template class actually creates the Dialog window and attaches the Winproc, basically everything you normally do to create a normal windows app.
I hope this helps!
Dan Willis
|
|
|
|
|
Okay, suppose I've got a simple AppWizard generated application. I'm relying on the WinApp message pump and I've called SetTimer(1, 1, NULL) .
Since there is just one timer which is not being killed, does the message pump keep reactivating that timer or does it activate the timer, then sleep, then activate the timer again?
|
|
|
|
|
A timer continues until you either call KillTimer() or the thread terminates - take its message queue with it. If you don't need the timer; however, it's best to destroy it to save CPU cycles.
Jeremy Falcon
Imputek
|
|
|
|
|
Hello all,
I have a problem with my app. i have a CListCtrl where i need to change between Multiple selected and single selected with a check box.
I have been looking through the articles but didnt find anything.
Can anyone help me please?
In advance thanks, Michael Olsen
|
|
|
|
|
I am assuming the CListCtrl is similar in this regard to the CListBox. If anyone knows of a good way to do this with CListCtrl, I want to know too.
But I do know you can't do it with a listbox. The Windows designers apparently never figured that someone might want to switch between single select and multiple select at run-time...
So your options are as follows:
Create *two* list controls, right on top of each other, one is a Multiselect, the other is a Single select. Show only the one you want at any given time. Whenever you change between Single and Multiple select, show the appropriate list, and synchronize the contents. The disadvantage is that functions that do something to the list control have to be smart enough to know which one to use... or you have to make a wrapper class around the list controls to handle it.
Create a custom control, or derive a new control from CListCtrl and do the rest of the functionality manually. Then post it on CP as an article.
You can pick your friends, and you can pick your nose, but you can't pick your friend's nose.
|
|
|
|
|
Try this, but I haven't tested it:
ModifyStyle(0, LVS_SINGLESEL);
ModifyStyle(LVS_SINGLESEL, 0);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Is this the way to get one handler to run but have different code executed depending on the menu item clicked? Is there some other technique?
In the OnMYMenu() handler, I did:
CString strA, strB, strC;
CString str1 = "A";
CString str2 = "B";
CString str3 = "C";
mmenu->GetMenuString(ID_PALETTEA, strA, MF_BYCOMMAND);
mmenu->GetMenuString(ID_PALETTEB, strB, MF_BYCOMMAND);
mmenu->GetMenuString(ID_PALETTEC, strC, MF_BYCOMMAND);
if(strA == str1)
{
dostuff();
}
if(strB == str2)
{
m_palette.bitCount = 0;
} etc
Thanks
Appreciate your help,
ns
|
|
|
|
|
Perhaps you should have a look at ON_COMMAND_RANGE for your message map. It's the "normal";) way to get the same function called for different menu items.
|
|
|
|
|
I'm on it.......it looks really cool! Now I'm trying to code it, but I do have a sample so I'm fairly certain I can do it. Many many thanks.....this was precisely what I needed.
BTW, whats your suggestion on getting dynamic menu items to run a function (no ID range is set since the number is not known at all .....) - cant use ON_RANGE for that....I tried doing win2Ks WM_MENUCOMMAND but no luck. Do you have any suggestions?
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
BTW, whats your suggestion on getting dynamic menu items to run a function (no ID range is set since the number is not known at all .....) - cant use ON_RANGE for that....I tried doing win2Ks WM_MENUCOMMAND but no luck. Do you have any suggestions?
I'm not sure whether it really works (because never needed it) but I think overwriting CWnd's OnCommand could work.
|
|
|
|
|
Question: Do you think the compiler etc can handle it if I set aside say 500 IDs ?
Can I do this: in resource.h
#define ID_START 5000
#define ID_END 5500
Then as I go through doing AppendMenu
for (int i = ID_START; i < ID_END; i++)
{
psubMenu->AppendMenu(MF_STRING, i, tempSub);
}
Then I could use the On_COMMAND_RANGE....
Appreciate your help,
ns
|
|
|
|
|
Uhm ... I must admit I never thought of such a solution. but as I see it, it could work, provided that there's no other ID defined between 5000 and 5500. Give it a try and you'll know whether it's practical or not.;)
|
|
|
|
|
I want to use 'iphlpapi.h' (I want to be able to use GetAdaptersInfo) in a MFC application, but I get this message:
Cannot open include file: 'iphlpapi.h'
What can I do?
Thanks
-- n
|
|
|
|
|
install the platform SDK (see msdn.microsoft.com/sdk[^])
Holy Sh*t! I'm speechless. (hey, that's a first) Marc Clifton, The Lounge
|
|
|
|
|
Thanks, I just realized after posting this question.
Sorry!
Thanks a lot.
-- n
|
|
|
|
|
Yes, I just installed the SDK.
But I get this error:
c:\program files\microsoft visual studio\vc98\include\iphlpapi.h(183) : error C2065: 'PMIB_ICMP_EX' : undeclared identifier
Any ideas.
Thanks
|
|
|
|
|
It's solved including the right directories in tools / options / directories.
Thanks
|
|
|
|
|
Is it possible to do it ?
I created a CButton in a dialog, and made it a CBitmapButton :
CBitmapButton myButton;
...
DDX_Control(pDX, IDC_OPTION_PANEL_CHECKBOX, m_myButton);
...
BOOL myDialog::OnInitDialog()
{
CDialog::OnInitDialog();
myButton.SetButtonStyle( BS_AUTOCHECKBOX );
myButton.LoadBitmaps(IDB_SHOW_HIDE_OPTION_PANEL_UP,IDB_SHOW_HIDE_OPTION_PANEL_DOWN );
myButton.SizeToContent();
...
}
If I do SetButtonStyle( BS_AUTOCHECKBOX ) I loose the bitmaps and the button becomes a simple checkbox button.
Did I miss the obvious ?
Thanks.
Max.
|
|
|
|
|
Hi,
I want to use this control in my win32 program (not mfc) through rc file.
When I use this control, the dialog box is not displaying.
Can anybody help please?
RC file excerpts:
CONTROL "",IDC_LIST1,"SysListView32",LVS_ALIGNLEFT | WS_BORDER |
WS_TABSTOP,81,10,60,50
Thanks in advance.
Regards,
Shivpal
|
|
|
|
|
void InitCommonControls(VOID);
|
|
|
|
|
Yes. I did it and its working now
Thanks a lot
Shivpal
|
|
|
|
|
WHy is this happening?
I have:
CImage & ImageRemus = m_PaletteMap[m_PalRemus];
If I put a breakpoint at this line and step in ,it crashes if I try to advance to next line of code (step over).
But if I put a breakpoint in the destructor of my CImage class, and say run to next breakpoint from this first breakpoint, it steps into the destructor!!!! (It crashes there).
Question is why is it stepping into the destructor?
Appreciate your help,
ns
|
|
|
|
|
There is not enough information, so I am going to guess.
1. member at position m_PalRemus does not exist.
2. CImage default constructor does not initialize object properly OR you did not overwrite copy constructor.
Could you show the whole function and exact declaration of the map. The declaration of CImage would help too.
|
|
|
|