|
void CMainFrameWnd::OnSize(UINT nType, int cx, int cy)
{
if(SIZE_RESTORED == nType)
{
// Use GetSystemMetrics function to obatin Display related information
// apply your logic here for resizing
}
}
Regards
Abhi
|
|
|
|
|
Hello,
I would like to ask if anyone knows if there are any tutorials and code samples for using libpqxx, because searching the net did not helped me out :/
|
|
|
|
|
Hi
I am working with CFileDialog in MFC SDI application. When I open a file for ex: test.txt from File->Open menu, the contents of the file are read and displayed on the view. When I select, File->Save option to save the contents of the file, a CFileDialog is displayed. When the selected file from CFileDialog is the same file as the opened one i.e test.txt, then a special message should be displayed to the user and the default windows warning message asking for replacing the file should not be displayed. However if any different already existing file is selected, then the default windows warning message should be displayed. In other words, I want to ovveride the function that is called when we click on CFileDialog's save button.
Can anyone please give me some inputs for doing this?
Thanks
|
|
|
|
|
The CFileDialog has a m_ofn data member that is the OPENFILENAME structure used by the underlying common dialog.
There is a lpfnHook member of that structure that allows you to intercept messages before the dialog processes them. In that hook you can react to what happens when the user commits the dialog with a specific filename being selected or not selected.
Search the MSDN documentation for OPENFILENAME and lpfnHook for more information and possibly examples/samples.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I am trying to build a Java launcher for a Java Product. Executing a Java application with a Batch file looks akward. I want a write code so that a native application written in VC++ can launch the Java application. The batch file of the application looks like this
---------------------------------------------------------------------------------------------------
set path=%PATH%;.\java\j2re1.4.2_07\bin;.\java\j2re1.4.2_07\lib;.\JMF2.1.1e\bin;
set classpath=.\JMF2.1.1e\lib\sound.jar;.\JMF2.1.1e\lib\jmf.jar;
java -classpath Sample.jar;%CLASSPATH%;%JMFHOME% -Djava.library.path=./Samplelib NrthSample.SampleMainApplication
---------------------------------------------------------------------------------------------------
Is there any way to lauch the Java application straight for the native application without the batch file? Can someone tell me which functions to use??
Regards.
|
|
|
|
|
vyjesh wrote:
Is there any way to lauch the Java application straight for the native application without the batch file? Can someone tell me which functions to use??
Yes. Google for 'Java launcher'
|
|
|
|
|
I used Visual Studio 6 to create a very simple dialog-based program. In the 'project setting', I have selected to "use MFC as a static library". After 'Release' building, I get the Released version of the EXE file. This 'executiable' does run very well on the PC which I used to develop the program. However, for the PC on which Visual Studio has never been installed, the 'executeable' may not run at all and no error message pops up. But if I install Visual Studio 6 on the PC, the executable file will be able to run. Even if I remove the Visual Studio 6 from the PC right after, the executable still runs. It seems a problem of missing dependancy files.
I downloaded Dependancy Walker to try to find the system files missing. And I tried to manually copy over and register the suspicious missing system files. I am not sure whether I did in a right way, but what I did does not help at all.
Please give me a helping hand if you have any clue to solve it.
|
|
|
|
|
You may need MSVCRT60.dll, which is the C runtime. Did you use any C functions in your code ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian,
Thanks for your reply.
I searched throught the PC where my EXE runs and there is no such a DLL called "MSVCRT60.dll". Instead, I found 3 similar DLLs called "MSVCRT10.dll", "MSVCRT20.dll", "MSVCRT40.dll". Hence it is not due to lack of "MSVCRT60.dll".
I have recreate my program step by step to see what caused the EXE not running. Innitially for the most minimum dialog, after "Release Build", it runs on all computers. But once I add one registered ActiveX control called "Microsoft Common Dialog Control, version 6.0" to my project and place one instance of the control onto my Dialog, the problem appears.
Hence the problem is because of the ActiveX control. I am not sure why this could happen because the Control itself is also from Microsoft Company.
|
|
|
|
|
So I got the dll name wrong.
It's obvious that that active x control then has a dependancy, probably the C run time. Copy the MSVCRT40.dll onto the target computer and see what happens. If that doesn't work, check google to find out what dependancies that dll has.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I got a bitmap in the memory, for example i got an object of CImage class, and i want to copy it to an Image (GDIPLUS), how to make it? I can't understand how can i use the IStream interface...
|
|
|
|
|
Is the image in memory an actual bitmap, or just the byte data ? If it's a bitmap, it would have to have a HBITMAP that you can pass to a constructor. If it's just a memory representation, then one of the bitmap types if you can write is MemoryBitmap. Perhaps you can pass one of those in to a bitmap as well ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I can't find constructor, that have a HBITMAP in input paramters...
The list of available contructirs:
Image();
Image(IN const Image& c);
Image(GpImage* image,Status status);
Image(IStream*,...);
Image(WCHAR*,...);
|
|
|
|
|
It's a static method - Bitmap::FromHBITMAP, I believe.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I posted a question few days back about the port blocking in windows 98. I got a suggestion to use Drivers to achieve the same.Can anyone give links regarding driver development...Especially links regarding how to use DDK to write device drivers so as to filter the ports.Hope I would get help on this.
URagav
Everything can be sacrificed for truth, but truth cannot be sacrificed for anything .
|
|
|
|
|
lok for [netsh] command
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi Thnx.. i looked for netsh command.But it is available only in XP and 2000 OS. I need to block ports on a Windows 98 PC.
URagav
Everything can be sacrificed for truth, but truth cannot be sacrificed for anything .
|
|
|
|
|
|
I have a console application c++
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
.
.
.
Is there a way to assign an icon to this app?
any help is greatly appreciated
|
|
|
|
|
Add an icon resource to the executable. The first icon in the executable will be used as the application's icon in windows explorer.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Im using visual C++ 5
in the workspace project I have these folders
-Source Files
-Header Files
-Resource Files (empty)
If right-click to any file, I only get add files.
Can you explain how add the icon resource?
|
|
|
|
|
Create a new resource file (File/New...) and add it to your project like you would any other source file. Then you can add an icon to the resource file. I haven't used VC++5, but it shouldn't be too difficult.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I am using the following structure in a console app (C++)
***********************************
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "c:\\MyProgram.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
***************************************************
It works great the only problem is that MyProgram.exe (creates bunch of files)takes a long time and it is hard to tell if it completed or not, I have to keep looking at the folder to see if all files are there. How can I display a dialog windows "This process will take few minutes, plese wait" when is completed?
|
|
|
|
|
It's a console app - why don't you output 'please wait for this process to end', and then after waiting for the process to end, put up a message to report you are done ?
In a Windows app, I just create a modeless dialog, and pull it down when the process returns.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I would do the launching of the external application in a background thread so that you can continue to pump messages, and create a modeless (non-modal) window with the "Please Stand By..." message. You would then wait for that background thread to exit (with an appropriate sane timeout, of course).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|