|
kk_mfc wrote: global variable which can be shared between different projects
You can save the value in the registry location and then you can use it from any of your project. Alternatively you can write the value into a file and then access it from different projects.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
Can anybody help me to get Icon details like its name, target path, working directory whenever it is double-clicked to run the application. This is be using Windows API or in C#.
I have already used IShellLink Interface but its been hard-coded for icon name. Suppose the user changes desktop icon name then also coding should be able to change its working directory. This can be done if I can check the existence of the icon.
Regards.
|
|
|
|
|
dear friends
disturb your you! how to import my own icon in my application? thank you.
Li Zhiyuan
8/06/2006
|
|
|
|
|
li zhiyuan wrote: import my own icon in my application?
Open the resource tab.Right click on .rc file. Select Add Resource.Select icon in the resource type window and then click on the import button. Browse for your .ico file and when done click ok.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
你可以在资源里面建一个图标。然后再保存文件再用你的图标文件覆盖系统生成的那个文件。
图标文件要求是32X32大小的。
这个问题可以去www.csdn.net上面检索。
----------------------------
Jerry yu
Email: fisheryj at gmail.com
|
|
|
|
|
abruti, on parle anglais ici
|
|
|
|
|
Hello
In MFC of VC++6.0, I write a dialog application. I have created a modeless dialog from main dialog. Could you please give me specific instructions to change size of modeless dialog when I get the figures up to date from main dialog?
Infomation
|
|
|
|
|
Hi,
you can use MoveWindow function for changing the size.
Regards
Velayudhan
|
|
|
|
|
You can also use the SetWindowPos API to change the window size run time.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
If you're trying to set the size of the window based on the content, you can use AdjustWindowRect or AdjustWindowRectEx to calculate the size of the new window based on the desired client rectangle.
These functions will convert your client rectangle into a window rectangle, which takes into account title bars, borders, etc. wich you then pass to the MoveWindow or SetWindowPos functions.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
How to show the 'Privacy Report' dialog in CHtmlView Based Application?
Thank you.
tomorrow
|
|
|
|
|
hi,
i can not use these code:
Bitmap* curBitmap = new Bitmap(L"sunset.bmp");
error for this code is:
f:\visual sutido project\ImageProcessing\ImageProcessing\ImageProcessing\ImageProcessingView.cpp(73): error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 arguments
is any opinion??!!!;)
|
|
|
|
|
|
Hi,
I am having this strange issue that I cant trace because my program works just fine when debugging from within VS or any other debugger (I tried olly as well), but whenever I run it from the explorer it doesnt work completly.
I am reading values from the registry using this Wrapper.
Then Im assigning the value of the key to a variable like this:
char * binaryData = (char *)value.operator LPCTSTR();
Then I'm converting the char from UTF8 to Unicode, but there should not be a problem.
However, the resulting string has in the most cases something appended like "=C:\Pr " which looks like a string to me but I have no idea how it got appended to the registry value.
The strange thing now is that whenever I debug it with VS it works, but when I run it normally from windows it puts those strange characters at the end of the strings.
Btw, my strings are in REG_BINARY format.
Does anyone know what the problem here is?
Thanks,
lucki_luke
|
|
|
|
|
try running from VS without debugger (ctrl-f5?) i think problem must be with env and/or project settings. we faced one similar problem where the error occurred only in release mode. we had to change some 3rd party libraries as far as i remember.
----------------------
Mayank Thakore
Learning C++ - since 1998
They didn't print my card right; so I resigned.
|
|
|
|
|
When running from VS without debugger it doesnt work either, and as I said before it works even when running from OllyDbg.
And Debug or Release mode doesnt matter as it works in both modes with debugger and not without...
I have totally no idea what to do...
|
|
|
|
|
Check for variables that are not initialized.
Debugger mode (or debug build) will initialize variables with some non-zero data, while release mode might contain random data or zeros.
That is usually the difference.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
Hi,
I'm having difficulties using CString's LoadString under VC++ 8.0. I'm not sure what to make of it. I'm attempting to load a string from resources and getting back an incomplete string, e.g. "This application is registered to %1 %2For use on the computer named %3 only." and getting back, "This application is registered to %1????". The '?' are inserted into the string. I'm a total newbee to VC++ 8.0.
It seems to be random, cause loading strings from the resource seems to work correctly in the instances above the lines of code before calling the last LoadString.
e.g.
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString cs0, cs1, cs2, cs3, cs4;
DWORD dwSizeUserName, dwSizeComputerName, dwError;
char szUserName[MAX_COMPUTERNAME_LENGTH + 1];
char szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
dwSizeUserName = MAX_COMPUTERNAME_LENGTH + 1;
dwSizeComputerName = MAX_COMPUTERNAME_LENGTH + 1;
szUserName[0]=0;
szComputerName[0]=0;
m_nAppIcon.SetIcon(::LoadIcon(theApp.m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME)) );
cs0.Empty();
cs0.LoadString(AFX_IDS_APP_TITLE);
AfxSetWindowText(::GetDlgItem(this->m_hWnd, IDC_STATICTEXTAPPNAME), cs0);
cs0.Empty();
cs1.Empty();
cs2.Empty();
cs3.Empty();
cs4.Empty();
cs1.LoadString(IDS_STRABOUTAPPINFO);
// IDS_STRABOUTAPPINFO =
// File Version: %s\nProduct Version: %s\nApplication Info: %s\n\n%s by
// %s. All Rights Reserved.
cs2.LoadString(IDS_FILEINFOCOMMENTS);
// IDS_FILEINFOCOMMENTS = Comments
cs3.LoadString(IDS_FILEINFOLEGALCOPYRIGHT);
// IDS_FILEINFOLEGALCOPYRIGHT = LegalCopyRight
cs4.LoadString(IDS_FILEINFOCOMPANYNAME);
// IDS_FILEINFOCOMPANYNAME = CompanyName
cs0.Format( cs1,
CAppUtilitylFunctions::GetFileVersionX(),
CAppUtilitylFunctions::GetProductVersionX(),
CAppUtilitylFunctions::GetVersionInfo(NULL, cs2),
CAppUtilitylFunctions::GetVersionInfo(NULL, cs3),
CAppUtilitylFunctions::GetVersionInfo(NULL, cs4));
AfxSetWindowText(::GetDlgItem(this->m_hWnd, IDC_STATICTEXT1), cs0);
if( !(::GetUserName(szUserName, &dwSizeUserName)) )
{
dwError = GetLastError ();
}
if( !(::GetComputerName(szComputerName, &dwSizeComputerName)) )
{
dwError = GetLastError ();
}
else
{
cs0.Empty();
cs1.Empty();
// THIS LOAD FAILS TO LOAD ALL OF THE STRING IN THE RESOURCE
cs1.LoadString(IDS_ABOUTAPPINFO);
// IDS_ABOUTAPPINFO =
// This application is registered to %1 %2For use on the computer
// named %3 only.
cs0.FormatMessage( cs1,
szUserName,
"\n",
szComputerName);
AfxSetWindowText(::GetDlgItem(this->m_hWnd, IDC_STATICTEXT2), cs0);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Can someone shed some light on this for me? I'm thinking that it must have something to do with project settings....
Thanks!
Jon68z
|
|
|
|
|
Jon68z wrote: // THIS LOAD FAILS TO LOAD ALL OF THE STRING IN THE RESOURCE
cs1.LoadString(IDS_ABOUTAPPINFO);
// IDS_ABOUTAPPINFO =
// This application is registered to %1 %2For use on the computer
// named %3 only.
Can you check its return value ? Its BOOL .
To narrow down the problem , can you check value in cs1, by showing it in message box?
|
|
|
|
|
Hi,
Thanks for the reply. using bool bRet, e.g. bRet = cs1.LoadString(IDS_ABOUTAPPINFO); The return value is 'true'. The string returned however is truncated and contains, cs1 "This application is registered to %?????" ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > as reported in the VC++ 8.0 IDE 'Autos' tab.
If I use a line like 'CString cs5(MAKEINTRESOURCE(IDS_ABOUTAPPINFO));' cs5 is equal to the same malformed string as if I loaded it from the resource string table above.
Do I have to specify something in my project settings ?
Or is something getting screwed up in the string table....
Thanks!
Jon68z
|
|
|
|
|
Problem seems to be with format specifiers you have mentioned. Can you see same problem with strings without format specifiers(%).
|
|
|
|
|
Hi,
Thanks for your reply. Actually, if I move the string loading to the top of the function, it works correctly. The entire string is loaded. I've tried several locations to narrow down where the load string gets truncated, but have not found the problem.
This is driving me mad, as I know something else is wrong, and it is not LoadString() per se, but have not been able to find the problem.
Thanks!
Jon68z
|
|
|
|
|
Hi,
I've changed the previous Format to FormatMessage and the specifiers to %1, %2, %3, etc. and all seems to be fine with the string loading as it should. It is hard for me to believe that using CString Format could screw up memory on an unrelated LoadString.... Hmmm.
Any body have any ideas on this?
Please help....
Thanks!
Jon68z
|
|
|
|
|
There is difference bet'n Format and FormatMessage , the way format specifiers are mentioned.
::FormatMessage documentation in MSDN can through some light on it.
Jon68z wrote: It is hard for me to believe that using CString Format could screw up memory on an unrelated LoadString.... Hmmm.
Actually , instead of using same variable(using Empty ), try using different variables.(this is just wild try).
|
|
|
|
|
Hi,
I have a CPropertySheet embeded in a CPropertyPage.
Can anyone tell me how to move or size the embeded property sheet?
Thanks in advance
Ferdinand
|
|
|
|