|
Is it possible to lift a dialog from one application and copy it into another (diaDlg.cpp and diaDlg.h). Its for a MFC Dialog based application, the dialogs are Modeless ones.
My new applications wishes to make use of one or two dialogs (out off about 8).
I would want the new application have complete control of the inserted dialogs.
For the resources, do you have to go into the resource.h file and lift them out, and renumber? Sounds bad if you do.
Or is it best to start from scratch again.
Regards,
Sweep
|
|
|
|
|
Try exporting the resource and then simply import the resource and .h and .cpp files into the new project.
Kuphryn
|
|
|
|
|
Thanks, but could you provide a bit more information.
If I select the dialog I wish to use in another program, the Export option is greyed out in the 'Resource View'
Also how do you import the Resources.
Sorry but at my limit of the IDE.
|
|
|
|
|
You mean that you didn't have source code available of application where the source dialogs are?
In any case, always it's possible to edit resources and copy and paste the dialogs you want in other application.
Jaime
|
|
|
|
|
:(Both programs are on my hard drive.
Its just I always worried about screwing up the IDE by
cutting/paste between applications.
But I would like to reuse a couple of modeless dialogs in another program.
Its just how to 'export' the resources from one into the other. I know
I can copy over the abcDlg.cpp and abcDlg.h files.
Any info would be useful.
Graham
grahamfff
|
|
|
|
|
Just open the EXE with VC++ resource editor.. copy and paste the dialog into your application.
You may need, however, to add manually IDC_ #defines to the controls.
Jaime
|
|
|
|
|
The safest way to copy resources from one project to another is by editing the .RC file and the resource.h file in the text editor. You can copy/paste the .RC text from one file to another, and do the same with the identifiers used by the dialog in the resource.h. You may need to renumber the identifiers after you paste them into the new resource.h.
Software Zen: delete this;
|
|
|
|
|
OK thanks your suggestion seems the best to date.
|
|
|
|
|
hi,
what can I use FileChannel(valid in JAVA) in C++.
|
|
|
|
|
Hi there,
Can anyone tell me how can I track other application window handle and automate/simulate the object evens on that application window like button press etc..
Application will be running on the same PC, just like an .exe application.
Regards
|
|
|
|
|
Use SendMessage() or PostMessage() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
1- use the spy to get the caption of the target window
2- use FindWindow to get the handle to this parent window
3- use EnumChildWindow(given the parent window handle) to loop onto the child windows of that parent window(like button,label,..etc
4- use SendMessage to fire the action of any child window.
any function i listed,see its def. from the MSDN,and its details..
by the way..i had automated so many other applications windows..
bye..
Amr
Hawk,amr
|
|
|
|
|
I've added an accelerator, then Ctrl+W then selected my main Dlg class.
However, when I run my program and press the keys, the accelerator doesn't work...
thanks for help
-Mike
|
|
|
|
|
Have you called LoadAccelerators() in the dialog's constructor? You'll also need to override the PreTranslateMessage() method and call TranslateAccelerator() accordingly.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hmm, can you give me an example please?
I'm kinda new...
CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CTestDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CD2HackKitDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
thanks
|
|
|
|
|
CTestDlg::CTestDlg(CWnd* pParent) : CDialog(CTestDlg::IDD, pParent)
{
m_hAccelTable = LoadAccelerators(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR1));
}
BOOL CTestDlg::PreTranslateMessage( LPMSG pMsg )
{
if (NULL != m_hAccelTable)
{
if (::TranslateAccelerator(m_hWnd, m_hAccelTable, pMsg))
return (TRUE);
}
return CDialog::PreTranslateMessage(pMsg);
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
I just completed an application for a company and they want a 30 day trial version made for demos.. can anyone point me in the right direction on how do add 30 day support? I have thought of looking at dates on files, creating reg keys etc.. but they want to make sure turning the clock back will not effect the time out. Any ideas?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
One thing you might do is to have your software quit after 30 minutes, 60 minutes of use. and always, always remove all save functionalities from your demo versions.
If you can't do that and want a full version with a 30 days limit, remove some functionalities, restrict/disable saving, ...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
I'm going to give it a shot.. Found that a little earlier today, there is another one in that area too..
I'll give it a try, Thanks!
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi all,
I have a set of property pages on a property sheet. I am trying to add a page to the sheet and change the title, but the title does not change.
If I do:
//AddPage(thepage);
//SetActivePage(thepage);
SetWindowText("TEST");
CString strTest;
GetWindowText(strTest);
Then strTest is changed to "TEST" correctly, but the text does not show up on the control.
Am i missing something?
Thanks and Regards,
Simon
|
|
|
|
|
See if MSDN article Q141487 helps. There's also the CPropertyPage protected member, m_strCaption .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes - the knowledge base article helped and I am now sorted.
Thanks very much,
Simon
|
|
|
|
|
SJolly wrote:
...and I am now sorted
I was not aware this was a sorting-related problem.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|