|
Hi, I can't figure out the cause of the following:
I've derived a general dialog class (say CMyDialogBase) from CDialog and in that class I've put OnOK() with ClassWizard. Then I've derived another dialog classes (say CMyDialogFinal from CMyDialogBase and put in OnOK() as well. Now when I call OnOK() from within CMyDialogFinal::OnOK() I expect CMyDialogBase::OnOK() to be called, but instead CDialog:OnOK() is called, even when I write the call like this CMyDialogBase::OnOK().
With OnCancel I don't get this problem - skipping the base class.
Can anyone tell me what is going on here?
Thx, Joep
|
|
|
|
|
You have inherit two classes from CDialog:
CDialog virtual OnOK()
|
v
CMyDialogBase virtual OnOK()
|
v
CMyDialogFinal virtual OnOK()
and implemented in all classes OnOK().
If you will call always CMyDialogBase::OnOK from class
MyDialogFinal, then delete function MyDialogFinal::OnOK().
The system will always find the virtual-function in
CMyDialogbase and execute this function.
If you use virtual-function, the system checks all class
(start at class from where you call the function) until it finds the function in this class or a higher-class.
I hope that help's.
|
|
|
|
|
Are you certain that you have capitalized OnOK the same in all classes? The fact that CDialog::OnOK is being called when you call CMyDialogBase::OnOK would seem to be a direct indicator that CMyDialogBase::OnOK doesn't exist (or may be spelled or capitalized differently).
|
|
|
|
|
I'm learning about COM in C++.
I want to create a com dll which will have 2 interfaces. 1 public method in each.
I then want to create a client to call a method on interface1, then use QueryInterface to return an interface pointer to interface2, so I can call the method on the second interface.
Both interfaces will have the same method name & parameters.
Where can I get sample code or tutorial to do this?
Cheers.
|
|
|
|
|
Create a new ATL project. Insert an ATL Simple Object from the ATL Wizard and define interface 1. Interface 2 can be implemented through a relatively simple cut and paste operation (although there are a couple of gotchas) - If you have MSDN - this is a good source of explanation. Otherise Inside COM by Microsoft Press, Beginning ATL by Wrox Press
p.s. You can't have the same method name for both interfaces, if you're planning on implementing this within the same C++ class.
|
|
|
|
|
I would like to know if there are any methods to intercept WIN32 API functions? For example, I want to get the string that would be displayed on the screen before it is actually displayed. Any code examples?
Thanks very much and I am looking for examples eagerly.
|
|
|
|
|
Hello eveybody
I didn't understand the values of lpdwFlags in the fonction InternetGetConnectedState
If we know that the possible values are:
#define INTERNET_CONNECTION_MODEM 1
#define INTERNET_CONNECTION_LAN 2
#define INTERNET_CONNECTION_PROXY 4
#define INTERNET_CONNECTION_MODEM_BUSY 8
why I had different results like these:
2: When i use only a LAN
18: When I use a modem (not connected)
81: When I use a modem (connected)
86: When I use LAN and PROXY
What is these values means?
Please I need your help
Thanks for all
Sylvain Demers
demerssy@ift.ulaval.ca
|
|
|
|
|
Hi,
I'm trying to set an enviroment variable from my program, but it vanishes after I make
the call, but it works (at least for the return code)
Is there any trick to make it work ? Or is there another function I need to use ?
Thanks,
Dennis
|
|
|
|
|
I have a dialogue based GUI aaplication,which i need to make a service.How can I do that ? I do not have any main function wherein I can take any commandline arguments.
Xzyeena.
|
|
|
|
|
There should be some helpful information in P.J. Naughter's article here on the site:
http://www.codeproject.com/system/cntservice.asp
|
|
|
|
|
check this:
CCommandLineInfo cmdInfo;
AfxGetApp()->ParseCommandLine(cmdInfo);
if (AfxGetApp()->m_lpCmdLine[0] != '\0')
{
char tmp[1000];
sprintf(tmp,"%s",AfxGetApp()->m_lpCmdLine),
AfxMessageBox(tmp);
}
else;
In CDialog-GUI you need the CWinApp-pointer (AfxGetApp()).
|
|
|
|
|
Hi all,
I have a problem that should have a simple solution. I have an MDI FormView-based app and it has two button on the toolbar where the user can choose to create a new form-based document version 1 or version 2.
Therefore I think I have 2 issues:
one, how to set the global variable after either clicking button 1 or 2. What function should I call after setting the var?
void CMainFrame::OnFileNew2()
{
view = 2; // set the global var
... // what function should be here to continue creating new doc?
}
two, how to choose the view based on the global var.
Can anyone help me? or does anyone have a sample code that just does that?
Thanks a lot in advance.
|
|
|
|
|
peace
every poor app can open an iexplore instance and tell it where to surf to ...
is there a doc on the web about this ?- i ownly found some on how to use CWebBrowser2 to write a new one
thanx
|
|
|
|
|
You can call ShellExecute() and pass it a URL (be sure to include the "http://" part) and it'll launch your default browser.
Look around in the registry under HKCR\http to find out more about the commands issued.
|
|
|
|
|
I am trying to manage a main dialog that must appear at the beginning of the app, disappear when the user has chosen an action an then reappear when the user has finished. It's kind of a primitive approach, but the users are all used to an old DOS program that I am converting to Windows. Can I mange the whole thing in CMainFrame?
Thanks,
F.L.
|
|
|
|
|
yup..make a function that displays your dialog and call that function from OnCreate and then later from OnDestroy... =)
|
|
|
|
|
Hi !
I wanna insert a bitmap in IE menu with the command InsertMenu (SDK) by an other app.
But i've never managed in that task
Someone could help me.
Shellmind.
|
|
|
|
|
Do you know how to export the settings under a directory in registry? I can use Export in Regedit, but i dont know how to invoke export programmatically. Any ideas? Thanks all!
|
|
|
|
|
Look up the RegSaveKey() function.
|
|
|
|
|
Hello,
for a project i want to be able to read contents from the registry of a remote machine (Windows 2000).
The problem is that the connection with RegConnectRegistry works, then i am able to open a key (RegOpenKeyEx and RegCreateKeyEx) and then read from it (with RegQueryValueEx). This goes ok for 2 times with REG_SZ values but then with a third ("VendorIdentifier" or "Identifier") i get an error message 997 that states error I/O operation pending.
I tried to work with WaitForSingleObject to wait until the 'server' is ready to send but this results in a wait failed and i am a bit clueless now!
Anyhelp would be very appreciated! =)
|
|
|
|
|
Hi,
isn't there any mapping function to convert a float to a unicode string?
_ttoi() and _ttol() are defined but im am missing _ttof().
Tx, Chris
|
|
|
|
|
Try
_stprintf(string, format, float value);
|
|
|
|
|
Hi Serge,
i need the conversion from ascii to float, not the other way round.
Tx, anyway for answering.
Chris
|
|
|
|
|
Hi all!
Maybe you can help me out with a little troubling issue I have regarding visual c++ 6. I have a piece of hardware that resides on 0x000D9000 (base), and that looks at the range (base to base + 603). This is a custom made piece of hardware so there is no driver for it. The thing is, I need to write a byte value to, lets say, (base + 30). But I can't get this to work correctly.
Does anyone have an idea on how to handle this?
Kind regards,
Bas Scholtemeijer
swave333@hotmail.com
|
|
|
|
|
Check www.sybera.de (SHA).
This package should have a memory-driver.
Try this site, maybe it's helpful.
|
|
|
|