|
Hi.
I try to create an ActiveX control (VC 6.0 FullControl) and i want to control size of my ActiveX control both in design mode and run time,to do it i override
IOleObjectImpl::SetExtent(...) method .But when i draw my control in design time (in resource editor) it have one size (SIZE* psizel param)but when i execute my application in run time it has another size.Please help.
Tanks.
|
|
|
|
|
Hi
I would like to know how to make a toolbar button toggle. For example, in MDI if there are two child windows and corresponding buttons on the toolbar for them, if the button is clicked once then the child window should appear and when it is clicked for the second time the child window should dissappear. Please help me regarding this. This is urgent.
Thanking you,
Regards
Ruchit Sharma. R
|
|
|
|
|
|
hi,
what problem in the following code. when i select new folder i got error. application is closed. i test i release mode. any one help to me.
CString m_strFolderPath;
LPMALLOC pMalloc = NULL;
LPITEMIDLIST pidl = NULL;
BROWSEINFO bi;
ZeroMemory(&bi, sizeof(BROWSEINFO));
// set the bi's default values
bi.hwndOwner = m_hWnd;
bi.lpszTitle = _T("Current folder is:");
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
//bi.lpfn = BrowseCallbackProc;
pidl = SHBrowseForFolder(&bi);
if(pidl != NULL)
{
SHGetPathFromIDList(pidl,
m_strFolderPath.GetBuffer(
m_strFolderPath.GetLength()));
UpdateData(FALSE);
// free memory
if(SUCCEEDED(SHGetMalloc(&pMalloc)) && pMalloc)
pMalloc->Free(pidl);
pMalloc->Release();
m_EditPath.SetWindowText(m_strFolderPath);
}
thanks in advance.
Murali.M
|
|
|
|
|
When you get a buffer for the path with GetBuffer() , you need to specify a buffer size to allocate. At the moment, the string is empty, so GetLength() returns 0, so your buffer is 0 characters long. Allocate at least MAX_PATH characters and you should be ok. You also need to release the string buffer after.
CString m_strFolderPath;
LPMALLOC pMalloc = NULL;
LPITEMIDLIST pidl = NULL;
BROWSEINFO bi;
ZeroMemory(&bi, sizeof(BROWSEINFO));
bi.hwndOwner = m_hWnd;
bi.lpszTitle = _T("Current folder is:");
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
pidl = SHBrowseForFolder(&bi);
if(pidl != NULL)
{
SHGetPathFromIDList(pidl, m_strFolderPath.GetBuffer(MAX_PATH));
m_strFolder.ReleaseBuffer();
UpdateData(FALSE);
if(SUCCEEDED(SHGetMalloc(&pMalloc)) && pMalloc)
{
pMalloc->Free(pidl);
pMalloc->Release();
}
m_EditPath.SetWindowText(m_strFolderPath);
}
Hope this helps,
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"
|
|
|
|
|
Hi Ryan,
Thanks for ur valuable comment.
Have A Nice Day!
Murali.M
|
|
|
|
|
In CreateProcess what shld be first and 2nd parameter, so that whole computer is searched for executable file say ypager.exe file.
|
|
|
|
|
1. The first parameter of the CreateProcess is the filename of the exe that you want to execute.
2. The second parameter is the commandline arguments (if any) that you wish to pass to the executable.
The createProcess wont search the whole system when you give a filename. It just execute the exe file that you specify by the first parameter.
if you need to run an executable that located somewhere in the system, use CFileFind class and its FindFile () and function to search the system for that file and then get the filepath using appropreate functions and then give it as the first argument of CreateProcess ().
Isn't it simple ?
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
|
Hi,
Why is my application showing illegal operation when i try to save a document created using CreateNewDocument().
It is an MDI application with Full Server option selected in Step 3 of AppWizard and Base class as CFormView. The base class for the document is COleServerDoc.
Other than using CreateNewFrame() and InitalUpdateFrame()what all should be added?
regards
kevcs2.
|
|
|
|
|
I want to open a new document on selecting a menu item.For this I used pDocTemplate->OpenDocument().Then I set a boolean variable, pDoc->m_bBool = TRUE; But in the LButtonDblClk() I get the variable GetDocument()->m_bBool as FALSE.Why is this so?
regards
kevcs2.
|
|
|
|
|
Have you tried setting a breakpoint on the varaibles to see if its being changed anywhere?
To do this, get the address of your m_bBool and enter it into the Breakpoints Data page as
*(int*)(0xaddress)
Set the elements to 1, and you shoudl get a BP set when the varaible is changed.
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
I need to load a bitmap file which is created at runtime on a dialog...how do i do it...?
|
|
|
|
|
To load the bitmap from a file at runtime, please use the code
HANDLE handle = LoadImage( AfxGetInstanceHandle(),
"filname.bmp",
IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
CBitmap* pBmp = CBitmap::FromHandle((HBITMAP)handle);
Now you loaded the bitmap from the file and you got a pointer of CBitmap class. And its now ready to use.
Isn't it simple ?
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Hi...
ThankYou for a valuable suggestion...how should i add that bitmap to a dialog..I used LoadBitmap() in OnInitDialog()...but its not working....
|
|
|
|
|
Use a CStatic control and use the SetBitmap() method.
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"
|
|
|
|
|
The LoadBitmap () function does not display the BMP to the dialog, It just load the bitmap from the file and gives us a handle. And from that handle we can make a CBitmap* and use.
And do you want to make the bitmap as your dialogs background pic ? if its the prblm the solution is below.
1. First add a member variable "CBitmap* pBmp" to your dialog class.
2. Then in the OnInitDialog () function of the dialog, add the following lines.
HANDLE handle = LoadImage( AfxGetInstanceHandle(),
"imagename.bmp",
IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
pBmp = CBitmap::FromHandle((HBITMAP)handle);
3. Now in the OnPaint () function of the dialog, add these code,
CPaintDC dc(this);
CDC memdc;
memdc.CreateCompatibleDC (&dc);
memdc.SelectObject (*pBmp);
dc.BitBlt (0, 0, WidthOfBMP,HeightOfBMP,&memdc,0,0,SRCCOPY);
thats all. Now the bitmap get painted in your windows background. And if its not the prblm feel free to ask.
Isn't it simple ?
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Thanks a lot Jijo....Its really simple and it worked...
|
|
|
|
|
i've tried FindWindow(), GetWindow() that kind of function call and try to get the handle of the window explorer and then destroy it, but failed. anyone have any idea how to do it?? Thanks.
|
|
|
|
|
use TerminateProcess or ExitProcess
|
|
|
|
|
please try this method.
1. First get the list of all process in the system. Use the function - CreateToolhelp32Snapshot ().
2. Then traverse through the list by using Process32First() and Process32Next using structure PROCESSENTRY32.
3. Then by traversing find the process of the windows explorer. User "szExeFile" member of PROCESSENTRY32 structure for Identifing the Process of explorer. Its the "path + filename" of the exe of the process. For us the path of explorer is - Get the value of the environment variable - <windir> + "explorer.exe". Because explorer.exe lies in the windows system folder.
4. Now get the handle of the explorer process using the OpenProcess () function. Pass the PROCESSENTRY32.th32ProcessID as the dwProcessId parameter of the OpenProcess () function. Now you get the handle as the return of the OpenProcess () function.
5. Now you got the handle. The rest is simple - Call TerminateProcess () function using the handle and the process will get terminated.
simple. isn't it ?
NB: Read thoroughly about each and every function ur using for this in MSDN. Many of the function are asking the privilage you need when you play on processes. So if you dont have necessery privilage, the Termination wont work.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Does any know how to convert a string to an int or float using the Win32 locale functions ?
I can get the GetNumberFormat to work great for me in converting an int/float to a string, but I'd like to go the other way, and I don't see any support for this.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
atoi and atof
?
#include <stdlib.h>
#include <stdio.h>
int main( void )
{
char *s; double x; int i; long l;
s = " -2309.12E-15"; /* Test of atof */
x = atof( s );
printf( "atof test: \"%s\"; float: %e\n", s, x );
s = "7.8912654773d210"; /* Test of atof */
x = atof( s );
printf( "atof test: \"%s\"; float: %e\n", s, x );
s = " -9885 pigs"; /* Test of atoi */
i = atoi( s );
printf( "atoi test: \"%s\"; integer: %d\n", s, i );
s = "98854 dollars"; /* Test of atol */
l = atol( s );
printf( "atol test: \"%s\"; long: %ld\n", s, l );
}
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
Yeah, but like the man said, he wants to use locales, In some countries, a comma is used instead of a point between numbers.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
couldnt he query the locale settings for number separator and modify the above code?
"there is no spoon" biz stuff about me
|
|
|
|