|
Ouuuuch! Trying to check statically declared ofstream for errors by if (!outfile) ?????
Use if (outfile.fail()) { ... } )
Robert-Antonio
"I launched Norton Commander and saw, drive C: on the left,
drive C: on the right...Damn, why I need two drives C:??? So I formatted one..."
|
|
|
|
|
Hi
Is it possible to add toolbar and statusbar to an dialogbased application?
WBR
Edi
|
|
|
|
|
|
Hi everyone,
I have class A in DLL with virtual function in it, like this...
<br />
class __declspec(dllexport) A {<br />
public:<br />
vitual void Foo() { some code; };<br />
}<br />
And there is derived class B in the same DLL...
<br />
class __declspec(dllexport) B : public A {<br />
public:<br />
vitual void Foo() { some code; };<br />
}<br />
Now, when I compile it, everything's ok. But I also have a console app where I create instances of class B from DLL. Of course I link .lib file with it. But when I try to compile this app I have an error from linker.
error LNK2001: unresolved external symbol "public: virtual void __thiscall B::Foo(void)"
Does anybody have any ideas how to solve this matter?
P.S. When I check EXPORTS from my DLL with dumpbin.exe, I can see both methods there. So, ?FooA@A@@ and ?FooA@B@@ are there. But linker's looking for ?Foo@B@@, without "A" at the end of the method name and obviously can't find it.
Any idea what's wrong?
Thanks in advance,
va'Lery
|
|
|
|
|
This is, I admit, a guess.
When included by the application, is it marked __declspec(dllimport) ?
You should normally write your header as follows:
#ifdef BUILDING_DLL
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif // def BUILDING_DLL
class MYDLL_API A { };
class MYDLL_API B : public A { }; and define BUILDING_DLL in the DLL project.
I'm not sure how well __declspec(dllexport) interacts with in-line member function definitions.
|
|
|
|
|
Thanks Mike,
I surely use mechanics that you described, so in my app I have __declspec(dllimport).
Concerning inline function, if I remove "virtual" when everything's fine. But that's not what I need. I have to use virtual function there.
va'Lery
|
|
|
|
|
hi.
Plz tell me how can i place a GIF file on a Dialog ,, and in a rich edit control
thanx
|
|
|
|
|
Hi!
GIF and JPEG files cannot be used in your application because they are copyrighted by their developpers.
As a solution you may put a webbrowser control and show the gif file in it ( you put it in a html file and it is done).
I hope this helps!
Well... I am a beginner ...
|
|
|
|
|
read about GDI+
it supports various graphics file formats, and is quite easy to use (for simple things
here's a quick plan:
1. initialize gdi+
2. initialize an Image from file (or stream)
3. initialize a Graphics object
4. display the Image through the Graphics::DrawImage()
5. deinit gdi+
well, sort of
there are many usefull examples here on codeproject
|
|
|
|
|
I m building voice conversation application .
now i want to send SoundBuffer (of Directx) via Socket to my server.
how can i send it .. will it be lose its data .
plz help mee
thanx
|
|
|
|
|
Hello, I have a MFC application that is running (dialog based with icon in task bar).
I want to terminate this apllication so I post the WM_CLOSE message to the handle of the window.... But that doesn't work !!
If I post the WM_QUIT message, that works fine
Why ???
|
|
|
|
|
One possibility - if the MFC dialog overrides OnClose() and doesn't call the base class's OnClose(), the dialog will not be closed.
|
|
|
|
|
Huummm yes ok !! That's it.
I have a button called Close on the dialog that just hide the window. I added a handler for this command: OnClose() and this function doesn't call the base class OnClose....
Thanks for reply !!
|
|
|
|
|
I have enabled multiple file selection in an Open-a-File dialog.
Please tell me how to obtain (a list of) all the selected files in this Open-a-file dialog and fill CListBox control with them.
|
|
|
|
|
Like this:
CFileDialog aDlg(...);
CListBox lb;
if(aDlg.DoModal() == IDOK)
{
POSITION pos = aDlg.GetStartPosition();
while(pos != NULL)
{
CString file = aDlg.GetNextPathName(pos);
lb.AddString(file);
}
}
|
|
|
|
|
Thanks a lot! It works great, but another problem is rising - if the selected files are too many (or
the string in the "file name" edit control is too long) - nothing happens - i tried to change some
of the members of the OPENFILENAME Structure, but with no result. Is it possible to make the "file
name" edit control to accept longer strings and how?
|
|
|
|
|
No problem
I'm not really sure what you are asking with the second part, so I'll try to answer three things you could mean
1. You get a problem when you have too many files seleced in the file dialog
2. You get a problem when the file name for one of them files selected is long
3. You get a problem when adding a large number of files, or a file with a long name, to the list box.
1.
As for as I know there is no limited on the number of files you can select, I've never seen it anyway. The only problem you might get is because windows adds each file you select to the edit control, so if you select a lot you may overrun the edit control - is that what you mean? If so, see 2.
2.
Hmmm... Well, the max length of a file name is MAX_PATH (255 chars) in Windows anyway, the edit control that accepts the file list should be able to take that easily, but with a lot of files it concevable you will overrun it.
The only thing I can suggest is to use the "explorer style" file dialog (the one with the places bar down the side) this may be able to handle a large list of files better. Though you are now faced with another problem. Using the explorer dialog via MFC is tricky. You have to set define _WIN32_WINNT >= 0x0500 (which also means this will only work on 2k+) but thats not all there is to it because the setting this define adds some extra members to the OPENFILENAME struct which cause windows to display the explore style dialog rather than the new one. Unfotunatly, the size of OPENFILENAME is set with in MFC and short of recompiling MFC dlls, you are stuck with it. There are ways round it, search for OPENFILENAME on MSDN and look for 2000 Peridocal (called C++ Q AND A) buy Paul DiLascia. It's called "Windows 2000 File Dialog Revisited; Autocompletion and the ACTest Demo App" and it will show you how to use the new open dialog which might fix your problem. Of course if it doesn't, then.. err..
The other thing it might be is this:
FIX: Common File Dialog Multiple Selection File Limit : Q179372
But this has aparently been fixed in a service pack. WHat version you running?
3.
If this is your problem you are hitting a limit with the number of entrys a list box can handle, use a CListCtrl instead.
|
|
|
|
|
Hi !
I'm trying in one of my listCtrl to implement a insert line function with the taste Insert.
But it appears that the "OnKeyDown" event doesn't work with that key when the NUM_LOCK key is on.
In that case, the Parameter nChar of the funtion OnkeyDown is always 255, and I can´t detect wich key has been pushed down. Couls someone gives me a tip ?
Tanks !!
Sébastien
Sébastien.V
|
|
|
|
|
try using GetAsyncKeyState()
|
|
|
|
|
Hi,
This probably a silly question but how does one get the an MDI app to stop producing an open view on start up?
Also, if I have 3 different types of views (e.g. CListView, CTreeView, CEditView) how does one create one a new view for each one without going through the menu?
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proff programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning."
|
|
|
|
|
RichardS wrote:
This probably a silly question but how does one get the an MDI app to stop producing an open view on start up?
In your CXXXApp::InitInstance () routine, you will find a variable of type CCommandLineInfo.
The CWinApp::ParseCommandLine function sets the cmdInfo.m_nShellCommand variable to FileNew if you
have no parameters.
Just set it to FileNothing before the CWinApp::ProcessCommandLine function is called.
RichardS wrote:
Also, if I have 3 different types of views (e.g. CListView, CTreeView, CEditView) how does one create one a new view for each one without going through the menu?
If you search MSDN Magazine / MSJ for a "C++ Q&A" article by Paul DiLascis about replacing views, it should
give you the information you need.
Iain.
|
|
|
|
|
Can anybody tell me why copying an unlocked block of global memory using memcpy() would cause the call stack to change. The code looked like this:
<br />
<br />
UINT size=GlobalSize(hGlobal);<br />
<br />
LPBYTE pBuffer=new BYTE[size];
<br />
memcpy(pBuffer,hGlobal,size);
<br />
I realised the problem was caused by not using GlobalLock() to get the actual address of the memory to copy but I have no idea why using the hGlobal handle as the source address would cause the call stack to change!
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hello!
GlobalAlloc() returns a "handle to the newly allocated memory object", and this does not mean pointer to allocated memory. So I suspect, that this handle is a pointer to structure, in which one of the field is pointer to memory (only suspission).
But: it did not overwrite my stack:
<br />
HANDLE hGlobal = GlobalAlloc( GMEM_ZEROINIT, 2048);<br />
UINT size=GlobalSize(hGlobal);<br />
LPBYTE pBuffer=new BYTE[size];
memcpy(pBuffer,hGlobal,size);
If you want to use memory pointer, take a look at the flag GMEM_FIXED in GlobalAlloc()
|
|
|
|
|
how did you get MDI windows to go out of status bar like in mIRC ?
http://flat.hypermart.net/mIRCstatusbar.gif
what is name of this class ?? extended status bar ?
is there a class or source code somewhere on this site or on any MFC sites.
|
|
|
|
|
ay ay ayy !!!!
that's not a status bar !!! that's a dynamic window.
TOXCCT alias Nicolas C.
|
|
|
|