|
First off, thanks for all the help you all are giving me. I've, however, tried all your suggestions without success. Here's the problem: I want to populate dialog fields with data from my Document class. What I did makes logical sense, but it gives me an 'illegal operation' message when I run the program. Here is the code:
BOOL CSetupDlg::OnInitDialog() {
CDialog::OnInitDialog();
//get pointer to Document
CSEIDoc *pDoc;
//initialize combo box
m_nPeriodDlg.SetCurSel(pDoc->m_nPeriod);//assertion failure here
//initialize check buttons
m_cbCheckGrowth.SetCheck(pDoc->m_bCheckGrowth);//and here
m_cbCheckFeed.SetCheck(pDoc->m_bCheckFeed);//and here
//initialize slider control
m_sdrHaloScale.SetRange(0,15);
m_sdrHaloScale.SetPos(XDIM/96);
return TRUE;
}
How can I overcome this? Thanks again,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
CSEIDoc *pDoc; This only declares a pointer to your document class, but does not actually retrieve it. Try with
pDoc=(CSEIDoc *)((CFrameWnd *)(AfxGetMainWnd())->GetActiveView()->GetDocument());
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I've tried to use CSEIDoc *pDoc = CSEIView::GetDocument; The error message was 'illegal call of non-static member function'. The statement you suggested '(CSEIDoc *)((CFrameWnd *)(AfxGetMainWnd())->GetActiveView()->GetDocument());' gives me a ''GetActiveView' : is not a member of 'CWnd'' error. Any idea how to fix this? Thx,
Ralf.
|
|
|
|
|
CSEIDoc *pDoc = (CSEIDoc *)(((CFrameWnd *)AfxGetMainWnd())->GetActiveView()->GetDocument()); Parentheses were not quite correct.
PS: Don't mean to be rude, but this was easy enough for you to fix on your own. I'd suggest you revise your knowledge about casting syntax. If you don't understand what this line of code is doing, please take the time to analyze it --getting help without trying to acquire some expertise on the way won't make you a better programmer.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
RalfPeter wrote:
//get pointer to Document
CSEIDoc *pDoc;
Can you see the problem? You declared a pointer pDoc of the type CSEIDoc, but did not initialize it. Later, you try to access the members of the object the pointer is supposed to point to, but does not, since it has not been made to do so.
Regards,
Rohit Sinha
|
|
|
|
|
RalfPeter wrote:
//get pointer to Document
CSEIDoc *pDoc;
that doesn't get a pointer to your doc. that just declares a pointer (which is filled with random garbage at best). you need to really get the pointer.
it's much nicer to do all your dialog variable setting/getting from the parent (ie. the doc in this case), rather than forcing the dialog to go back to the parent. the first way allows your dialog to be used anywhere (not just from a doc). the second way ties your dialog to the doc forever. maybe that's not an issue here, but in general it's nice to have a dialog that you can reuse.
-c
For men use, if they have an evil turn, to write it in marble:
and whoso doth us a good turn we write it in dust.
-- Sir Thomas More
|
|
|
|
|
when i use that function (AfxGetInstanceHandle())in managed class i got an exception i do not know how to handle it.
how to sue it in managed vc++ code ?
how to sue it in c# code ?
plz help me.
r00d0034@yahoo.com
|
|
|
|
|
I don't know how to maximize app window (I want to have window which will fill whole desktop). I have a MDI application and I'm also not sure which window should be maximized (it sounds stupid, isn't it?), should it be MainFrame? Thanks for any help.
|
|
|
|
|
AfxGetApp()->m_pMainWnd is a pointer to the the window to maximize.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Call AfxGetApp()->m_pMainWnd to get a pointer to the main application window and then call SetWindowPlacement() for the returned pointer.
If you want to keep the existing flags and other things for the window, call GetWindowPlacement() prior to calling SetWindowPlacement() and store the WINDOWPLACEMENT data that you get and then change the showCmd member of the WINDOWPLACEMENT structure.
Regards,
Rohit Sinha
|
|
|
|
|
Hi Everyone
Does anyone know if the Winsock API's can be used to connect between Desktop and Pocket PC running Windows CE???
If not, what's the alternative?
Thanks,
Cheers
Yogi
|
|
|
|
|
what ever be the operating system the TCP/Ip stack is same
u can use client app on pocketpc side srvr app on Desktop side
just u use unicode on client side
anju
|
|
|
|
|
What MS Dev. Kit contains the SSPI libraries? I can't seem to find Secur32.lib anywhere in VC6.
Thanks!
. djrisc .
|
|
|
|
|
User mode or kernel mode?
User mode: its all in Secur32.lib
Kernel mode: hand over lots of cash to MS and buy the IFS kit.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
Hi!
I have a little game in OpenGL that I run in a window. So, I want to display some debug info in that window with the GDI API.
The problem is that when I fill a rect with the gray color (for ex.) OpenGL redraw the all window and not only his viewport. Somebody could help?
thanks
Signed Twofy.
If you havn't answer to your problem, that because you havn't a problem.
|
|
|
|
|
I am trying to use the function UrlEscape() declared in shlwapi.h. I have the latest SDKs, have made sure that shlwapi.h has been #include d and that I am linking with the shlwapi.lib library. My problem is so stupid that I don't know what to do. I have done everything I could think of short of pulling my hair.
The compiler says, "UrlEscape: undeclared identifier".
What is wrong? What am I missing? I have made sure that the constants _WIN32_IE and _WIN32_WINNT are appropriately defined. Everything is alright, as far as I can determine, but I still am getting this error.
Am I missing something obvious? Would somebody please tell me what it is?
Mucho thanks.
Regards,
Rohit Sinha
|
|
|
|
|
The problem has corrected itself on its own. I closed Visual Studio in frustration and started again after sometime. This time everything compiled correctly.
Dunno what's going on. Spooky.
Regards,
Rohit Sinha
|
|
|
|
|
Hi Rohit,
Apparently i am also using the same function. However I get a different error
which says "too many initializers".
Please can you give an example of how to use this function.
Would be very greatful to you.
Thanks,
John
|
|
|
|
|
Here you are. For the exact meanings of the parameters, and return values, check your MSDN. I have not compiled or tested this, so be careful before you use it.
CString UrlStr = "http://www.somesite.com/start page.htm";
DWORD cchBuffer = 1;
TCHAR temp;
HRESULT hrUE = UrlEscape(UrlStr, &temp, &cchBuffer,
URL_DONT_ESCAPE_EXTRA_INFO | URL_ESCAPE_SPACES_ONLY);
LPTSTR pOutStr = UrlStr.GetBuffer(++cchBuffer);
hrUE = UrlEscape(UrlStr, pOutStr, &cchBuffer,
URL_DONT_ESCAPE_EXTRA_INFO | URL_ESCAPE_SPACES_ONLY);
UrlStr.ReleaseBuffer(cchBuffer);
Hope this helps.
Regards,
Rohit Sinha
|
|
|
|
|
Hi there,
I want to add a feature in my program that user can change the language …
For example in a OS, I installed 3 languages like English U.S and Farsi and Russia.
I want to change the active language (English U.S) to other language (Farsi), programically …
How can I do that ?
Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
1) DLLs with resources (1 language/1 dll) - used in WndTabs - You can download its sources to see.
2) Text files with localized texts - used in Windows Commander - advantage is, the users can localize it themselfs, complications with dialogs, localized bitmaps imposible.
3) You can have multi-language resources in your aplication - the language is then selected by the OS according to local settings.
Sonork 100.15206;PavelK
|
|
|
|
|
It is relatively simple to start your app in one or another language (depending for instance on some registry value). MSDN article HOWTO: Create Localized Resource DLLs for MFC Application explains the procedure. For the language change to take effect while the program is running things are a lot messier: probably you're better off relaunching the app after setting the new language (you can even do this programmatically from the exiting instance so that the user has the illusion of having the change set on-the-fly).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
you can even do this programmatically from the exiting instance so that the user has the illusion of having the change set on-the-fly
are you saying there's a way for an app to restart itself? i've been looking for that for years...
-c
For men use, if they have an evil turn, to write it in marble:
and whoso doth us a good turn we write it in dust.
-- Sir Thomas More
|
|
|
|
|
Pardon me? Maybe we're not talking about the same issue, cause the restarting stuff is almost trivial: Get a grip to the program own name with GetModuleFileName(NULL,...) and realunch it at the end of InitInstance with, for instance, CreateProcess .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
yeah. slightly different. i need a way to relaunch after the app is really shut down (as opposed to almost shut down).
-c
For men use, if they have an evil turn, to write it in marble:
and whoso doth us a good turn we write it in dust.
-- Sir Thomas More
|
|
|
|