|
Hi,
Can anyone tell me how to launch my application when a file of particular type is clicked. For example, whenever I click a PDF file it automatically opens in Adobe right, something similar to that.
Awating you peoples earliest response.
Thanks In Advance
Cheers
|
|
|
|
|
So what you want is register a file extension.
To do that, you need to update some registry keys :
Under HKEY_CLASSES_ROOT\ create a key with your extension, say .myapp, and assign it the value MyApp.
Then under HKEY_CLASSES_ROOT\ again, create a MyApp key, and create following structure HKEY_CLASSES_ROOT\MyApp\shell\open\command , and assign the path of your application to the command key.
Check ::RegOpenKey and associated functions for handling registry keys.
What you want to achieve is usually done by an install programm, since you need the path where the user will install your app. This is very easy to do using InnoSetup (Google for it).
Hope this helps
~RaGE();
|
|
|
|
|
Use ShellExecute() with the "open" verb.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi All,
When i am compling my project all files are getting compiled though i do not modify all the files. I think this is related to any setting issue. Can any one please tell me how to stop compilation of all files.
|
|
|
|
|
Look in project/solution settings. The option is smth like "incremental linking" if I'm not mistaken. You include the files you needn't compile every time in stdafx.h
-- modified at 5:48 Monday 27th February, 2006
|
|
|
|
|
Hi,
could you please tell me the advantage of including a file in stafx.h. Does it play a difference role when included in stdafx.h than in other parts of the project?
Thanks In Advance
|
|
|
|
|
The difference is that these files only get recompiled if you use "Rebuild All", otherwise they are assumed to be without any changes unless you make these changes from within Visual Studio.
Usually you will include in stdafx.h all libraries and other code that won't be modified by you during development.
|
|
|
|
|
If you change things in a header file (.h), all files that include this header file will be recompiled again because they depends on this file.
|
|
|
|
|
Hi All,
Can anyone of you help me out for the below requirement.
I just want to desing an application that has the same functionality as a print application. Meaning that, if I enter the number of pages to be printed in a textboc or so how to manipulate the same internally.
Are there any VC++ classes available for this??
Reply at the earliest please.
|
|
|
|
|
You can do this with MFC, see MSDN for CYourStandardKindOfView printing support. Basically, it's about overriding several virtual functions in your view implementation.
|
|
|
|
|
Hi,
Sorry
Can you be more specific in the class name or some thing. The one that you have mentioned "CYourStandardKindOfView" is it a MFC class? I dont find any with this name.
Sorry for the trouble.
Thanks
|
|
|
|
|
|
Does anybody know how to count all the files on a windows environment.
Currently i have a recursive method that goes through all the folders counting the number of files. It takes too long
Any faster method would be appreciated
Thank You
Fate pays tax to know man
|
|
|
|
|
theprinc wrote: Currently i have a recursive method that goes through all the folders counting the number of files.
AFAIK this is the only way.
Nibu thomas
Software Developer
|
|
|
|
|
Something makes me think there is no faster way. I mean if there was one why would it take Explorer so long to count the number of files when you invoke Properties command for a particularly huge directory?
Try optimizing your recursive function instead. After all, it gets called over and over again and if by chance it contains unoptimized code... well, it'll slow down for a reason.
|
|
|
|
|
I Second NIBU!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
theprinc wrote: Currently i have a recursive method that goes through all the folders counting the number of files. It takes too long
Any faster method would be appreciated
Show us the function and maybe we can make suggestions.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi there,
I wish to know when printer settings are changed and which printer (in a users session), in a server environment (win2k3), I know about WM_SETTINGSCHANGE but lparam seems to get only "devices" and not the printer name.
What I can do is enumarate all printers and keep track of their DEVMODE and each time the notification WM_SETTINGSCHANGE happens i will enumrate AGAIN all printers and compare with the previous list of devmodes to check if a setting has chhanged. As you can see this is very inefficient.
In your opinion are there other ways to this, at least detect from which user this change has happened, so to check only his/her printers.
Thanks
Adam
|
|
|
|
|
I made a program that used the gethostbyname(hostname); function in MFC. it worked fine. now when i tried to do the same in a win32 project it is returning null. before this i added the header file "winsock2.h". which showed some errors as redefinition of this xxxxxxx . then i removed it and added the ws2_32.lib reference, after which, it showed no errors but at gethostbyname(hostname); function it returns NULL. have i done anything wrong ? the hostname string contains a genuine hostname. Please answer this
Kss
|
|
|
|
|
Try to find the error that occurred using WSAGetLastError .
Go through this[^] to find out what happened.
Nibu thomas
Software Developer
|
|
|
|
|
Thank you, it helped me ,it was a silly error i didnot call WSAStartup() :->
thanks again
kss
|
|
|
|
|
Imediatly after filling a listview with all my data I wish to set the first item as selected.
I use the folowwing:
ListView_SetItemState(GetDlgItem(hwnd,ID_DATA_LIST),0,LVIS_SELECTED,LVIS_SELECTED);
ListView_SetItemState(GetDlgItem(hwnd,ID_DATA_LIST),0,LVIS_FOCUSED ,LVIS_FOCUSED);
This is setting the list item as selected, but it does not give it the focus. i.e. Selected items usualy are highlighted in blue, but mine are simply highlighted in grey until the item is clicked.
Is there something I am missing?
|
|
|
|
|
You should have to call the SetFocus function of the list view control.
nave
|
|
|
|
|
I understand that I need to use the SetFocus function, but where exactly should it be called?
WM_SETFOCUS // doesn't work
WM_INITIALIZE // doesn't work
When text is being updated within contols via WM_SETTEXT, would that cause a loss of focus? I thought these sort of procedures would pass the focus back if set at all.
|
|
|
|
|
u should have to set focus to the list control before you set an items selection state.
SetFoucs(GetDlgItem(hwnd,ID_DATA_LIST));
ListView_SetItemState(GetDlgItem(hwnd,ID_DATA_LIST),0,LVIS_SELECTED,LVIS_SELECTED);
nave
|
|
|
|