|
Is there anyway in code to create a file association. i.e. I want to associate a file type of .log with notepad. I know how to do this via Windows explorer, can I do this at runtime?
Thanks in advance,
Bob
|
|
|
|
|
You can create registry keys at HKEY_CLASSES_ROOT.
Create one for the file extesion (Ex.: .log) and put as default value a mime type (Ex.: text/plain). If the mime doesn´t exists you can create another key at HKEY_CLASSES_ROOT with a subkey shell\open and put the command to open the file there.
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
The alcohol is one of the greatest enemys of man, but a man who flee from his enemys is a coward.
|
|
|
|
|
|
Is there any way to have a combo box without the button to drop the list down? If not can the button be resized in any way?
Ed
|
|
|
|
|
Wow, a combobox without the buttong to drop list !!!!
It became an editbox or a listbox !!!!
I can't understand you !
Hung Son
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
Ha ha, I know it sounds strange, but I still need it to drop the list when the user clicks the box or hits F4, I just can't get the boxes to fit where they need to without getting rid of the button somehow. I am dealing with a screen drawn for a character based program and I have to use the same layout so my space is limited.
Ed
|
|
|
|
|
you would need to do subclassing already.
how about checking this out.
http://www.codejock.com/developer/article02.htm
this makes a flat button.
so now u can don't draw the buttons instead
|
|
|
|
|
Hi,
Is there any way I can convert a HRESULT to the "errorcode string"
I mean, the HRESULT 2147746132 means "Class not registered", is there any functions that takes a HRESULT and gives me a string with the error text?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
FormatMessage API function will works with predefined HRESULT.
Philippe Mori
|
|
|
|
|
From MSDN Q169498:
// Obtain the error message for a given HRESULT
CString LogCrackHR( HRESULT hr )
{
LPVOID lpMsgBuf;
CString strTmp;
::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
hr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL );
// STR_TMP is defined within LOG.CPP to provide safe format string
// for both ANSI and UNICODE
strTmp.Format( "%s", (char *) lpMsgBuf );
// Free the buffer.
::LocalFree( lpMsgBuf );
return strTmp;
}
Brandon
The WTL newsgroup: over 1400 members! Be a part of it. http://groups.yahoo.com/group/wtl
|
|
|
|
|
I'm subclassing a static control. I would like to get the mouse click messages but they don't seem to get generated. I get them if I subclass from a button.
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Mamke sure the static control resource on the dialog has the Notify style set to be able to get mouse messages.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
That did it. Thanks!
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
I created an ATL DLL server project and inserted a new ATL object as a simple one, named Inter. Next, i added a new BSTR-type property named Str.
I wrote:
STDMETHODIMP CInter::get_Str(BSTR *pVal)
{
_bstr_t x(*pVal, FALSE);
m_str=x.copy();
return S_OK;
}
This code links perfectly on debug versions but generates this error:
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
on release versions.
Do you know how to handle it?
rechi
|
|
|
|
|
|
This is straight from MSDN, help topic _ATL_MIN_CRT :
Note When building a Release version of a project, you can get the following link error:
LIBCMT.LIB(crt0.obj) : error LNK2001: unresolved external symbol _main
This error occurs if you are using CRT functions that require CRT startup code. The Release configurations define _ATL_MIN_CRT, which excludes CRT startup code from your EXE or DLL. To avoid this error, do one of the following:
Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. On the Project menu, click Settings. In the Settings For: drop-down list, choose Multiple Configurations. In the Select project configuration(s) to modify dialog box that appears, click the check boxes for all Release versions, and then click OK. On the C/C++ tab, choose the General category, then remove _ATL_MIN_CRT from the Preprocessor definitions edit box.
If possible, remove calls to CRT functions that require CRT startup code and use their Win32 equivalents. For example, use lstrcmp instead of strcmp. Known functions that require CRT startup code are some of the string and floating point functions.
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Thanx!
That was it.
rechi
|
|
|
|
|
I have written an MDI application and its almost finished. I just need to display a help file written in Compiled HTML.
What's the easiest / quickest way to do this?
Thanks
Ali
|
|
|
|
|
Just use shellexecute to execute the compiled .chm file.
Simon
I need your clothes, your boots, and your copy of VS.NET.
Sonork ID 100.10024
Recent bug fixes to Walton's pr0n organiser v1.2b
- fixed a bug where the user's FAT table would be wiped for no reason
- fixed a bug where the user's computer would explode, killing everyone within a 5 foot radius
|
|
|
|
|
yeah, the line of code is
HINSTANCE nRet = ShellExecute(this->m_hWnd, "open", szBuff, NULL, NULL, SW_SHOWNORMAL);
where szBuff is a string variable which contains the full path of the file name and the file name itself.
Thanks!
|
|
|
|
|
Great, I just tried it exactly as you typed it lucy, and it worked straight away, just what I needed.
Thanks.
Ali
|
|
|
|
|
In win2K, it's no problem, but in win98, it's difficult to do.
I try to alphablend by myself, but i can't refresh my dlg when something behide the dialog changed , then i try to set timer to notify me refresh the dialog every a short time, but when the dialog is showwing, i can't get the bitmap behide the dialog from the desktop DC.
anyone could help me?!!
|
|
|
|
|
Maybe you could try to start by specifying WS_EX_TRANSPARENT sty;e when creating your windows. That ways, Windows will paint Windows behing yours first...
But it will not works as smootly as it does in Windows 2000 for few reasons:
- I'm not sure that it apply to non-client area.
- It will causes blinking
- It will probably be slower (particulary when movig full window)
- It's probably a bit bugged and/or limited.
You may also try to enumerated windows behind you and cause them to be paint in a memory DC. It will probably works for some kind of windows and not for others...
Philippe Mori
|
|
|
|
|
Thanks a lot!
Let me try...
|
|
|
|
|
See samples 'DC Utilities' on this site (use search). If you will complete your code successfully, please, mail me result, I want to see it!
|
|
|
|