|
When Visual Studio creates a Dialog Based C++ program it creates projectDlg.cpp and projectDlg.h.
How can a global function call a member function of the projectDlg class?
The glogal function is defined in projectDlp.cpp.
Thanks,
Kevin
|
|
|
|
|
EW_dude wrote: How can a global function call a member function of the projectDlg class?
get an instance of that object type, or make the member function static .
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I tried the static approach. static void disp();
But to get the global function to compile I had to type
projectDlg::disp(); Got it to compile.
But now disp() doesn't see any of the variables of the class. I get "illegal reference to non-static member" when I try to set a variable.
Any ideas?
|
|
|
|
|
EW_dude wrote: But to get the global function to compile I had to type
projectDlg::disp(); Got it to compile.
Of course. This is how static member functions work.
EW_dude wrote: But now disp() doesn't see any of the variables of the class.
Because they are not static . Read up on what static means in a class.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
EW_dude wrote: Any ideas?
give your global function a pointer to the dialog. the very simplest way to do this is to just create a global variable to hold that pointer, then have your dialog set it (maybe in the dialog's constructor - and be sure to set that pointer to NULL when the dialog goes away)
then you can do:
CMyDialog *g_pDialog = NULL;
void MyGlobalFuncion
{
if (g_pDialog)
g_pDialog->memberFunction();
}
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
No matter what types of project (dialog based, Doc/View ...) you are working or what types of tools (VC++, C++ Builder, ...) you are using, you are using the C++ Language. Everything just follows the rule of the C++ Language.
So you may just search for where the auto variable of type class CProjectDlg is. And then you know what to do.
For example:
void g_MyGlobalFunction(CProjectDlg* p) { }<br />
CProjectDlg* g_pTheDlg = NULL;<br />
BOOL CProjectApp::InitInstance(void)<br />
{<br />
CProjectDlg dlg;<br />
g_pTheDlg = &dlg;<br />
dlg.DoModal();<br />
}<br />
Maxwell Chen
|
|
|
|
|
Is there a way to move a file to a different folder based on its file extension only? I want to move by the file's extension is because the program I wrote in C++ will create a file with the current date and time as its filename. I was wondering if any C++ functions would do that or any other alternatives.
Thanks in advance!!!
Lynniz
|
|
|
|
|
|
I actually figured out an alternative way. I am using the Gdal Library with C++. Instead of declaring a name for the file at the beginning, I directed the file to the destination folder first and then named it. It might sound little confusing since I am not using straight C++.
I would still like to know if there is a way to move the file by extension only in C++.
Thank you,
Lynniz
|
|
|
|
|
Lynniz wrote: I would still like to know if there is a way to move the file by extension only in C++.
I concur with Chris' suggestion.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thank you guys, I will try that method too.
Lynniz
|
|
|
|
|
|
Just upgraded to VS2005 from VS 2002. What an ugly, distracting environment - but I'll get used to it.
Right now the one thing I'm stuck on are the "expand/contract" icons that appear in the source code. They are eyesores. But I can't figure out how to turn them off - does anyone know?
Thx
|
|
|
|
|
You mean Code Outlining?
Try Tools / Options / Text Editor / 'C/C++' / Formatting and then turn off 'Enter Outlining Mode When Files Open'
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
In VS, go to Tools -> Options. Select Text Editor -> C/C++ -> Formatting. Uncheck "Enter outlining mode when files open".
You can close and reopen VS to reset outlining in all open docs, if you want.
Remember that you can toggle outlining for the current document with Edit -> Outlining -> (Stop Outlining) or (Start Automatic Outlining).
--
I've killed again, haven't I?
|
|
|
|
|
Thanks to all for the replies. Turns out the correct option is the "Selection Margin", which makes no sense to me (I had already turned off all of the other suggested options)
|
|
|
|
|
Actually, the "Selection Margin" option controls just that--the selection margin. In addition to removing the outlining controls (which lie in the selection margin), removal of the selection margin also removes the selection margin itself.
The presented solutions remove just the outlining controls as requested.
--
I've killed again, haven't I?
|
|
|
|
|
I upgraded an MFC app from 7 --> 8 and my dialogs do not have the xp styles. Is there something I have to do? I thought 8 embedded the manifest for you.
Thanks
Kurt
|
|
|
|
|
Upgraded apps are not the same as newly created apps. i.e. the project settings (etc) are not changed behind your back (which is probably a good thing.
I used the following to get the XP style in my app:
http://www.codeproject.com/w2k/xptheme.asp[^]
Warren
|
|
|
|
|
Found this somewhere, put into stdafx.h, pretty easy.
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|
|
|
|
Hi I am new here. I want to write some code for Pocket PC using Visual Studio.Net 2003 and visual c++/MFC.
I already have some code in MFC / visual studio.net 2003.
I want to rewrite them for Pocket PC.
My question is does Pocket PC support MFC in visual studio.net.
If yes can you suggest some tutorial/ notes/ book on that subject.
|
|
|
|
|
hi,
i want to ask how to call or load the .bmp file into c++ programme?
what command should i use?
tq....
|
|
|
|
|
For starters:
LoadBitmap()
LoadImage()
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Add a bitmap resource with an ID of IDB_MYBITMAP (or whatever ID you want) to your project. With App Studio, you can do this by either creating a new bitmap resource and setting the ID, or by choosing Resource, Import, and importing an already created bitmap with a .BMP extension.
Using LoadBitmap() to load bitmap in your resource, example
void CMyDlg::OnPaint()
{
CPaintDC dc( this ); // Device context for painting
CBitmap bmp, *poldbmp;
CDC memdc;
// Load the bitmap resource
bmp.LoadBitmap( IDB_CORPLOGO );
// Create a compatible memory DC
memdc.CreateCompatibleDC( &dc );
// Select the bitmap into the DC
poldbmp = memdc.SelectObject( &bmp );
// Copy (BitBlt) bitmap from memory DC to screen DC
dc.BitBlt( 10, 10, 47, 47, &memdc, 0, 0, SRCCOPY );
memdc.SelectObject( poldbmp );
// Do not call CDialog::OnPaint() for painting messages
}
-----------------
conglt
|
|
|
|
|
hi,
why'll the foll. error occur,
cannot open Debug/last.exe for writing ,wher last is my project name.
Pls let me know,
bye
swapna_signsin
|
|
|
|