|
Michael Dunn wrote:
See REDIST.TXT in your VC 6 directory for a list of files you can redistribute. IIRC WinSock has its own installer which you can redistribute.
I should point out that it will save you a huge amount of headaches if you statically link to MFC. That way you don't have to redistribute the huge DLLs, nor worry about what happens if the machine has a newer version of the DLLs (will it break your code? probably not, but you never know; why risk it?).
I will have a look at the file. I've also changed my app so they use MFC statically (with dozens of multiply defined symbols... ) so that should cut it down a bit.
Michael Dunn wrote:
Absolutely not.
Ahh crap. So how do I go about distributing an application that relies on SHBrowseForFolder() and the like? Can I just assume that if MSDN says "Needs 98 or later" that any 98 or later machine will have a shell32.dll that supports SHBrowseForFolder()?
J
May the bear never have cause to eat you.
|
|
|
|
|
need to print last n lines if the text as well as n is specified in the program.
|
|
|
|
|
Um, we won't do your homework for you.
--Mike--
"Adventure. Excitement. A Jedi craves not these things."
-- Silent Bob
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi.
I just discovered an interesting properties of formview in MFC. Consider a formview that displays multiple dialog boxes as windows. The program displays the dialog box windows via ShowWindow(SW_SHOW). However, for some reason the framework will suddenly hide the dialog box windows if the user presses a control key, i.e. ESC, ENTER, etc. Thus, when the user presses a control key, the framework hides all dialog bow windows and all you see is controls that are embedded in the formview via Resource Editor.
I would like to know is it possible to circumvent this property of MFC's formview?
Thanks,
Kuphryn
|
|
|
|
|
Hi
maybe you just have to overried OnOK() and OnCancel()
of that dialog box classes. cause when you press ENTER
OnOK() will be called and the window destroys itself. the
same thing happens for ESC and OnCancel()
|
|
|
|
|
|
when I use "DestroyWindow" to Destroy a view, there are errors appear as follow:
"Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.
Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called."
can you tell me the possile reason ?
thanks in advance.
liuty
|
|
|
|
|
hi
are you trying to destroy a window in that window's class
deconstructor? I think when deconstructor is called, the
window is already destroyed, so no message can be sent to it,like WM_DESTROY( which invokes OnDestroy).
|
|
|
|
|
QUESTION 1:
i just want to confirm that I can register and unregister my ATL-COM wizard created server by calling LoadLibrary and invoke DllRegisterServer/DllUnregisterServer directly - as opposed to command line util Regsvr32.
For some reason, the code is not working, and with no compiler or runtime error - I cant even tell if the function call has been executed. I know however that the register the component does not exist in registry - after i run the following subroutine:
//TO UNREGISTER SERVER:
int UnRegQueryGen(char * pszDll)
{
DWORD dwError;
typedef STDAPI (*PFUNC) (void); //QUESTION 2: This will cause : error C2159: more than one storage class specified
//So, I changed it to:
typedef void (*PFUNC) (void); //and it seems to work fine (i.e. no compiler error)
//<caution! quote="" from="" msdn..="">
//If the string specifies a path but the file does not exist in the specified directory, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).
//STEP 1: Load dll.
HINSTANCE hLib;
hLib = LoadLibrary(_T(pszDll));
//STEP 2: un-register server
if(hLib!=NULL)
{
PFUNC pFunc = NULL;
pFunc = (PFUNC) GetProcAddress(hLib, _T("DllUnregisterServer"));
if(pFunc!=NULL)
{
//Unregister the server!
pFunc();
}
else
{
//Additional exception handling here.
dwError = GetLastError();
FreeLibrary(hLib);
return 0;
}
}
else
{
//Additional exception handling here.
dwError = GetLastError();
return 0;
}
FreeLibrary(hLib);
return 1;
}
//TO REGISTER A SERVER
int RegQueryGen(char * pszDll)
{
typedef void (*PFUNC) (void);
//STEP 1: Load dll.
HINSTANCE hLib;
hLib = LoadLibrary(_T(pszDll));
//STEP 2: register server
if(hLib!=NULL)
{
PFUNC pFunc = NULL;
pFunc = (PFUNC) GetProcAddress(hLib, _T("DllRegisterServer"));
if(pFunc!=NULL)
{
//register the server!
pFunc();
}
else
{
//Additional exception handling here.
FreeLibrary(hLib);
return 0;
}
}
else
{
//Additional exception handling here.
return 0;
}
FreeLibrary(hLib);
return 1;
}
One last point, the exposed DllRegisterServer and DllUnregisterServer is implemented by ATL Wizard, so, I dont think there's anything to do with it.
Thanks!
norm
|
|
|
|
|
Hi.
I am working on a project that contains a formview class with multiple dialog windows visible. As the user make changes to each dialog box, I want to update the document class. I implemente a message solution. The dialog boxes update send messages to the view class. The view class update the document class.
In general, the solution above is adequate. However, in this particular project, the dialog windows are visible in the formview. I would like to know is there other more elegant solutions?
For example, is it possible to implement a GetDocument() function that returns a pointer to the document class inside the dialog boxes? As another example, how about passing the dialog boxes pointers to the document class? I do not want to implement these solution unless messages fail. Thus these solutions should be last resorts.
Thanks,
Kuphryn
|
|
|
|
|
I'm sure there are a million answers to your question. But I would stick to the message solution. It is the best way for windows to communicate. I would not pass pointers to class objects around to be used. That could be potentially dangerous. If the WPARAM and LPARAM parameters seem to limiting remember you can allocate memory (or objects; classes, structs, etc.) and pass the pointer to another window through a message.
if(IsWindow(hwnd))
{
CThing *pThing = new CThing;
PostMessage(hwnd, WM_NEW_THING, 0, (LPARAM)pThing);
} Just remember the receiver of the message is responible for deleting the memory.
long CMyWnd::OnNewThing(WPARAM wParam, LPARAM lParam)
{
ASSERT(lParam);
CThing *pThing = (CThing *)lParam;
...
delete pThing;
} One more thing, in the OnDestory method of the CWnd class make sure you have no more WM_NEW_THING messages in the queue. Their memory should be deleted if they are.
MSG msg;
while(::PeekMessage(&msg, (HWND)NULL, WM_NEW_THING, WM_NEW_THING, PM_REMOVE))
{
CThing *pThing = (CThing *)msg.lParam;
delete pThing;
} Hope this helps.
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Recommendation noted.
Thanks,
Kuphryn
|
|
|
|
|
where can get stuff about these?
|
|
|
|
|
The easiest way is to put a batch file that does it onto the PC in question and execute it remotely.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
hi, what's wrong with copying a file with fread and fwrite?
int CopyQueryGenDll(char * pszOutfile)
{
FILE *stream;
//Size of QueryGenAlpha.dll = 249 kB
int nDllSize = 1000;
char * buffer = new char[nDllSize];
if(buffer==NULL)
{
//Exception handling here.
return 0;
}
int i=0;
int numread = 0;
int numwritten = 0;
//Initialize buffer:
for(i=0; i
|
|
|
|
|
1) You're trying to read and write a binary file in text mode - the carriage return line feed translations are going to screw it up.
2) Why not just use CopyFile()?
Dave
|
|
|
|
|
thanks, just did. i tried to stay with stdio.h because it's more portable - in case if any part of the code needs to be deployed under a UNIX environment.
norm
|
|
|
|
|
Hi!
I always wondered why VC6 and VC.NET do not use multiple compiler instances when running on a SMP box. On unix running gnu make in parallel mode is just an argument away. Why can't have this on VC too?
|
|
|
|
|
How many PC's have more than one processor ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Seems like a chicken and egg question to me .
I'm pretty sure many developers would buy SMP machines if their compiler could use the power to divide compile times by two!
All my dev machines are SMP for quite simple reasons, the first being that programming multithreaded code and testing it only on mono proc machines is one of the best way to shoot one slef in the foot .
|
|
|
|
|
MeeLoo wrote:
the first being that programming multithreaded code and testing it only on mono proc machines is one of the best way to shoot one slef in the foot
I'll give you that, in a second. However, this is Microsoft who until now have not given us partial template specialisation because, well, no Windows programmer uses it. Of COURSE we don't use it, they have not let us.....
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hehe .
That's probably why lobbying for features like these can be important, no?
Sebastien
|
|
|
|
|
I guess so - good luck !!!
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
QUESTION 1:
i typed at the command prompt:
C:\somefolder\regsrv32 mysever.dll
Error from regsrv32: "myserver.dll" is not an executable file and no registration help is registered for this file type.
and
C:\somfolder\regsrv32 /u myserver.dll
Error from regsrv32: same as above.
It's an ATL-Wizard created COM btw.
QUESTION 2:
btw, I also tried to register and unregister with WinExec. Is there anything wrong? forward slashes Vs back slashes?
#include "stdafx.h"
#include <windows.h>
#include <iostream.h>
int main(int argc, char* argv[])
{
int nRetCode = 0;
nRetCode = WinExec("RegSvr32 /u C:\Program Files\RealTime7\QueryGenAlpha\QueryGenAlpha.dll", SW_SHOW);
if(nRetCode <= 31)
{
cout << "WinExec failed..." << endl;
}
return 0;
}
The error was not reported thru the console (ie. nRetCode>31), but:
(a) A pop up from regsvr32 appeared, and:
"LoadLibrary("C:Program" failed - the specified module cannot be found"
(b) I also tried to call LoadLibrary from client directly. But LoadLibrary failed. And GetLastError() reported after call to LoadLibrary:
193 is not a valid Win32 application. ERROR_BAD_EXE_FORMAT
Code as follows:
HINSTANCE hLib;
hLib = LoadLibrary(_T(pszDll));
//STEP 2: un-register server
if(hLib!=NULL)
{
PFUNC pFunc = (PFUNC) GetProcAddress(hLib, _T("DllUnregisterServer"));
if(pFunc!=NULL)
{
//Unregister the server!
pFunc();
}
else
{
//Additional exception handling here.
dwError = GetLastError();
return 0;
}
}
else
{
//Additional exception handling here.
dwError = GetLastError();
return 0;
}
One last thing: When I build (Ctrl-F5) the ATL COM server project, I had no problem at all. THe server get registered, and I tested the server from VB client and it worked!
Thanks!
norm
|
|
|
|
|
just found this link:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q249873
not sure if i can spot the problem....
norm
|
|
|
|