|
The type safe and portable way
Convert any type for which an ostream << operator is defined.
template<class T>
std::string to_string(const T &t)
{
std::stringstream ss;
ss << t;
return ss.str();
}
Use std::string::c_str() to retrieve char*
|
|
|
|
|
I have several projects in vs6 which I'm trying to convert to vs7. In vs6 I have html context sensitive helps which fail to work in vs7.
I tracked down the problem to OnCommandHelp which is where it goes when I press F1 on an area of interest. The following in the vs6 implementation:
LRESULT CFrameWnd::OnCommandHelp(WPARAM, LPARAM lParam)
{
if (lParam == 0)
{
if (IsTracking())
lParam = HID_BASE_COMMAND+m_nIDTracking;
else
lParam = HID_BASE_RESOURCE+m_nIDHelp;
}
if (lParam != 0)
{
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->WinHelp(lParam);
return TRUE;
}
return FALSE;
}
What happens is lParam gets a number, and through pApp it points to my application and goes to WinHelp. This all works very well.
In vs7 for some strange reason lParam is zero. This is the first mystery. The other strange thing is that instead of pApp->WinHelp, there is pApp->WinHelpInternal. I wouldn't mind changing the name from WinHelp to WinHelpInternal, but it isn't getting a non zero value for lParam up front.
Can anyone suggest what needs to be changed? I can't convert over to vs7 until I fix this problem.
Thanks,
Ilan
|
|
|
|
|
How create 3 D Push Button control in dialog?
thanks in advance.
|
|
|
|
|
thiyags wrote:
How create 3 D Push Button control in dialog?
http://www.codeproject.com/buttonctrl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
How can I edit the Active Directory from my application? I mean to add users, to read from Active Directory, etc...
Thanks in advance!
Have a nice day!
|
|
|
|
|
//adding a user
void AddUser(LPWSTR UserName,LPWSTR UserPassword)
{
CoInitialize(NULL);
IADsContainer *container;
LPWSTR ADPath = L"LDAP://serv1/CN=Users,dc=codeproject,dc=com";
hr = ADsOpenObject(ADPath, UserName, UserPassword, ADS_SECURE_AUTHENTICATION, IID_IADsContainer, (void**)&container);
IDispatch *pDisp;
hr = container->Create(L"user",L"cn=Efter",&pDisp);
container->Release();
IADsUser *pUser;
hr = pDisp->QueryInterface(IID_IADsUser,(void**)&pUser);
pDisp->Release();
VARIANT var; VariantInit(&var);
V_BSTR(&var) = L"Yevgeny";
V_VT(&var)=VT_BSTR;
hr = pUser->Put(L"samAccountName",var);
hr = pUser->SetInfo();
VariantClear(&var);
pUser->Release();
CoUninitialize();
return 0;
}
|
|
|
|
|
Hi,
I am working with SDI application in MFC. When I click on the restore button on the system menu of the MainFrame window, the window dimensions should be set to 2/3 the width and height of the screen resolutions.
Can anyone please suggest, where and how to handle this event?
Thanks
Madhavi.
|
|
|
|
|
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 .
|
|
|
|
|