|
But there is a problem with that.It should run for all users at the first installation,then uses can change it.If I use that it will only run for the user that install it and will not run by default.
Mazy
No sig. available now.
|
|
|
|
|
Use that key, but make your program check some value under HKEY_CURRENT_USER that the user can use to specify whether the program is to run. This way the program run for all users, but if the user-specific key is set to some value, then exit immediately. If the user-specific key does not exist, then just continue as normal.
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
hmmm,thanks Roger.
Ryan Binns wrote:
but if the user-specific key is set to some value, then exit immediately.
Do you think other program use thiis techniqe,run the program and exit immediatley!
Mazy
No sig. available now.
|
|
|
|
|
More often than you'd think
Yes, it's a fairly common technique - to start and program to actually see whether it needs to be started. It sounds crazy but it's one of the best ways of doing it.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
I have another problem now.
Ryan Binns wrote:
but if the user-specific key is set to some value, then exit immediately. If the user-specific key does not exist, then just continue as normal
What happend if user want to run by him/herself after start up.Then he/she can not run the program because that key does not exist.
Mazdak
|
|
|
|
|
Anonymous wrote:
What happend if user want to run by him/herself after start up.Then he/she can not run the program because that key does not exist.
You didn't specify that before
I would still do the same thing, but specify some sort of parameter ("/startup" comes to mind) on the command line when run from the registry Run key. If this parameter is not present, then you can assume that the user ran it from a shortcut, and just run as usual. If the parameter is present, then you can assume it was run from the registry, and then do the operation I suggested before. I've written a couple of programs that do this and it works beautifully.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
thanks. Its a nice tip. But how can I pass parameter when I run from the registery key? I guess I have to write something in some place of registry?
Mazy
No sig. available now.
|
|
|
|
|
Exactly the same as in a shortcut - on the end of the program string value in the registry
"c:\my path\myprog.exe" /startup
or something similar.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
Thanks Ryan
Mazy
No sig. available now.
|
|
|
|
|
|
Is there a common method of providing a UI for adding and deleting rows in a CGridCtrl? I can certainly develop various solutions but I wanted to check to see if there is something useful that already exists.
For adding, one solution is to always have the bottom row be empty and available for adding an entry, such as what MS Access does for tables. Is that a solution that is commonly used? If so then I can probably figure it out easily enough.
For deleting, one solution is to implement a context-menu. I assume it is easy enough to determine the row that the click is in. Another solution is to allow the Delete key to provide that capability and/or a Delete button.
I have implemented code that determines if a cell, but only one cell, is selected. I should improve it to allow as multiple cells to be selected, as long as it is for one row. However it would help to have an option that permits only a single row to be selected. There appears to be an option for that but the option requires "List mode" and I have not become familiar with that. If I can't use that then I hope there is a way to catch the event of the change in selection and to provide single-row selection that way.
|
|
|
|
|
Hi all,
I am experiencing a strange problem when declaring classes outside the main source file in VC++. I have made an experiment that demonstrates my problem. There are two files: “main.cpp” and “class.cpp”.
“main.cpp” content:
#include "class.cpp"
int main() {
return 0;
}
“class.cpp” content:
class Class {
public:
void Test();
};
void Class::Test() {
return;
}
When I try to compile I get following error:
<br />
--------------------Configuration: main - Win32 Debug--------------------<br />
Compiling...<br />
main.cpp<br />
class.cpp<br />
Linking...<br />
class.obj : error LNK2005: "public: void __thiscall Class::Test(void)" (?Test@Class@@QAEXXZ) already defined in main.obj<br />
Debug/main.exe : fatal error LNK1169: one or more multiply defined symbols found<br />
Error executing link.exe.<br />
<br />
main.exe - 2 error(s), 0 warning(s)<br />
It says that the function void Test() is already declared, but how? Please help me, am I doing something wrong?
Aidman » over and out
|
|
|
|
|
pretty simple to fix:
the class prototype should be in a header called class.h
The class implementation (the class' function definitions) should be in class.cpp.
Both main.cpp and class.cpp should #include "class.h"
|
|
|
|
|
Great! Thanks alot
Aidman » over and out
|
|
|
|
|
Hello, I'm curious on how to make the item selection in ComboBoxEx control the way that Michael Dunn's Custom Draw does int the ListView control (without selecting the icon - the last part). Any ideas?
Thanks,
Deian
PS: No custom draw available for ComboBoxEx, according to my MSDN documenation
|
|
|
|
|
I've never used ComboboxEx controls much, but I think they work like the regular combobox - set either the CBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWFIXED style, then handle WM_MEASUREITEM and WM_DRAWITEM .
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Ok, I have an application where many bitmaps are displayed on the screen. The user has to be able to click on the bitmaps and move them around and delete them and other things like that. What I was originally doing was handling WM_LBUTTONDOWN and finding the bitmap that was closest to the cursor position. What I would like to do, and I don't know if this is possible, is have each bitmap in its own little invisible window that could recieve its own messages, like WM_LBUTTONDOWN. I don't know how to do this or even if it's possible, so any help would be greatly appreciated. Is there a better way to go about doing this?
Thanks,
Steve
|
|
|
|
|
It's hard to say what's the "best" way w/o knowing how your app is structured. What I personally would do is keep an array/list of RECT s that hold the coordinates of each bitmap. Then when you get a WM_LBUTTONDOWN message, use PtInRect to find which RECT the cursor was in. Then you'll know which bitmap was clicked.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Hi
I have a SDI application (made by AppWizard). MRU list is handled in standard way (just like in applications made by AppWizard).
Here is my problem: when recent file list is empty (for example program is launched on some system for the first time or someone has cleaned proper registry key) there is an empty menu item in File menu. Is there an easy way to hide such empty MRU item? I don't want to handle MRU by myself (that will surely solve my problem). Thanks in advance for any help.
Mariusz Popiolek
|
|
|
|
|
You can't just hide menu items - you have to remove them from the menu,
I wouldn't recommend attempting removing this item though. MFC uses the this menu item as a basis for adding the new ones. If you remove the "no files" (or whatever it is) menu entry, then it won't know where to insert any subsequent files in the MRU list.
You're better off just leaving it the way it is, unless you do want to handle the MRU yourself.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
I've subclessed a few classes like CEdit, CListBox,...
If I bind these classes to resources created with the resource edit all works fine. But if I use Create(..) then the controls assume System to be their default font and Edit boxes are drawn without a border and not even adding WS_EX_CLIENTDGE does the job.
Does anyone have any idea why this is happening?
Thank you
Artur Jales Moreira
|
|
|
|
|
jales wrote:
if I use Create(..) then the controls assume System to be their default font
'System' is the default font. In order to set the font to the currently selected user font for dialogs, try this: control.SetFont(::GetStockObject(DEFAULT_GUI_FONT)) .
jales wrote:
Edit boxes are drawn without a border
Add the WS_BORDER style to the dwStyle parameter specified in your Create call.
Software Zen: delete this;
|
|
|
|
|
First of all, thank you! SetFont(..) did the job.
As for the border, I didn't explained correctly what happens, the problem is that the border is a single black line instead of a 3D looking border.
Thank you
Artur Jales Moreira
|
|
|
|
|
The 3D border styles are extended styles. To use those, you should call CreateEx, which lets you specify an extended style argument in addition to the normal style argument.
Software Zen: delete this;
|
|
|
|
|
You're the man. That did the job.
At first I did check CWnd::Create() and saw that it called CreateEx but I forgot that the extended styles were a different parameter.
Thank you
Artur Jales Moreira
|
|
|
|