|
VCProgrammer wrote: i really cant get it whats going wrong here, Without a lot more information I don't think we can either.
|
|
|
|
|
please sir tell me what other information you required to help me.
|
|
|
|
|
You need to show some more of the failing code and the error messages or codes that you receive. Remember, we cannot see your system and are not familiar with your program.
|
|
|
|
|
Richard MacCutchan wrote: Remember, we cannot see your system... Atlantic ocean in your way, Richard?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yes, and the fact that you people will insist on hiding below the horizon.
|
|
|
|
|
in my test application for button icon:
i have 2 Icon,load them in resource with id IDI_ICON1,and IDI_ICON2
2 buttons :CButton m_btn;
CButton m_btn2; on which i wan to set the icon
if i set the icon style true for buth buttons its working fine and display the icon on button in XP.
but when i FALSE the ICON style for button and run this application,only text of button is display not the icon on button.
now please help,if want something more please tel me what information i provide you to better assist me...
BOOL CBtnIconDlg::OnInitDialog()
{
HICON hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
AfxMessageBox(ErrorMsg());
if(hIcon)
{
}
else
{
AfxMessageBox(_T("NULL hIcon"));
}
m_btn.SetIcon(hIcon);
AfxMessageBox(ErrorMsg());
HICON icon =NULL;
HINSTANCE hInstResource = NULL;
hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(IDI_ICON2), RT_GROUP_ICON);
AfxMessageBox(ErrorMsg());
if(hInstResource)
{
}
else
{
AfxMessageBox(_T("hInstResource null"));
}
icon = (HICON) LoadImage(hInstResource,
MAKEINTRESOURCE(IDI_ICON2),
IMAGE_ICON,
16,
16,
LR_DEFAULTCOLOR);
AfxMessageBox(ErrorMsg());
if(icon )
{
}
else
{
AfxMessageBox(_T("NULL icon "));
}
m_btn2.SetIcon(icon);
AfxMessageBox(ErrorMsg());
return TRUE;
}
CString CBtnIconDlg::ErrorMsg()
{
CString ret_msg=_T("");
LPVOID lpMsgBuf;
HRESULT hr;
hr = GetLastError();
ret_msg.Format(_T("%d :: "),GetLastError());
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
hr,
0,
(LPTSTR) &lpMsgBuf,
0,
NULL
);
ret_msg+=(LPCTSTR)lpMsgBuf;
LocalFree( lpMsgBuf);
return ret_msg;
}
|
|
|
|
|
I suspect the error 87 should be ignored as you have not checked if the previous function was successful or not. You can validate that by calling SetLastError(0) before the SetIcon() call. You also say that when you set icon style to FALSE it does not display the icon; isn't that what it should do?
|
|
|
|
|
i set icon style to FALSE,coz i dont want only icon on button is display
i want icon and text both are display on button....
|
|
|
|
|
|
thanks for your guidance and support ,but please help me what function use to display text and icon on button....
|
|
|
|
|
|
according to the documentationt set icon on button use CButton:SetIcon method,that have i already used...as you know also is not working fine...
|
|
|
|
|
I just tested this on my system and it works fine, using the BM_SETIMAGE message. I am not sure how you would do that in MFC but I guess in much the same way.
|
|
|
|
|
sir you tested this on XP?
|
|
|
|
|
|
sir i already told so many times os version upper than XP, my code also working fine,
the problem is just about XP and lower version...
|
|
|
|
|
|
I have managed to get my XP VM set up and have run a number of tests but cannot make this work. Having a look around with Google it seems that this feature does not work on XP, despite the fact that the MSDN documentation states that this should work on versions from Windows 2000 and above. It looks like you are stuck, and the only solution is to decide whether to use text or icon in your product.
|
|
|
|
|
yes sir thanks...
i am using now NM_CUSTOMDRAW and its solve my problem...
|
|
|
|
|
Hello Everybody,
I hope i have choosen the right forum for my Question.
I have a little application which starts another programm with a specific path (a txt-file).
Yes, easy and simple, it works fine with ShellExecute, but i have a problem with some Executables(I have to test a few programs). One Executable opens correct but it don´t opens the given path. I don´t understake whats wrong, because if I drag and drop the txt-file manualy on the executable it works.
So my Question is, are ShellExecute and Drag&Drop two different things to open a programm? Does anybody know a way to fix my problem ?
Thanks in advance,
Michael
|
|
|
|
|
You need to show the section of the code that tries to start the program and explain exactly what part of it is not working.
|
|
|
|
|
void StartEXE (String^ path)
{
TCHAR prog[] = TEXT("C:\\...\\....");
string p ;
MarshalString(path, p);
std::string str= p;
TCHAR *param=new TCHAR[str.size()+1];
param[str.size()]=0;
const TCHAR open[] = TEXT("runas")
ShellExecute( NULL, open, prog, param, NULL, SW_SHOWNORMAL );
}
void MarshalString ( String ^ s, string& os )
{
using namespace Runtime::InteropServices;
const char* chars =
(const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer();
os = chars;
Marshal::FreeHGlobal(IntPtr((void*)chars));
}
This is the code i use. I call StartEXE with a String like C:\\test.txt , the programmpath is fix in the code.
The Programm i want to open opens but it don´t open the path.
This happens only by one Programm, if i want to open another programm this code works.
Any Ideas?
|
|
|
|
|
Without seeing the actual parameters and the code of the executing program it's impossible to guess what may be happening. It would probably be a good idea to add some debug code to the called program so you can see exactly what parameters it is trying to deal with. What is the "runas" parameter supposed to do?
|
|
|
|
|
You might also want to consider asking for help here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
That should only work if the application you want to start supports command line parameters, or if it the default application for starting the document type you're trying to open.
|
|
|
|