|
This is not coded by me.
I use it as a class to format foppy disk.
But when compiling my project I found this error,
in the meantime I don't know it too much.
So I want to need a help here.
Now I have displaced it with "#include <stdafx.h>"
Altough I can run my project(in multi-threads), a warnig dialogue
is popped up, saying:"You do not have sufficient rights to perform this operation",when call "DoModal" funtion and reach here:
FormatResult = (*dl_SHFormatDrive)( hWnd,cDrive - 'A', SHFMT_ID_DEFAULT,bQuickFormat?SHFMT_OPT_FULL );
Why is this do you know?
|
|
|
|
|
I am trying to find a way so that not so many file header must be included when I want to use a class from a DLL from a class that has many other headers included. All I know is that when I inlcude one header everything included in it must be included etc. This creates really quite a chain. Any way out of this I do not know.
For one of these situations, I am including a MODELESS dialog in a class. Because the way I am doing it now is to include a pointer to it in the declaration I have to include the header in the main class header. I want to move the header inclusion to the .cpp file. I was thinking about making a global declaration in the .cpp file. Then just create it by new etc. This would be for the entire duration of the program. I do not want to make it modal because that would disrupt the other parts of the program which has to run during this. If multiple programs call this DLL, would this still work?
Would another better way be just to call it modally then call peek and translatemsg etc in that function call?
Anyone know more ways to "hide" the header files so that it does not have to be included for DLL but can be hidden in the .cpp file?
Thank you in advance.
|
|
|
|
|
If I understand you correctly, you need to make use of forward class declarations:
class CDLLClass;
class CYourClass
{
CDLLClass *m_pDLLClass;
}
#include "YourClass.h"
#include "DLLClass.h"
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
HI Roger.
You mean to forward declare it as you did, I do not have to include the header file that particular class in the header of the class that use it? This way I do not have to include it in the project that calls the DLL? For variables that are pointers you can do this. Any other means to help reduce the amount of files you have to include in the caller of the DLL?
Thanks.
|
|
|
|
|
I want to run my program at start up,so I set the registery key HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run for doing this.But I want my users can change the setting so my program may run at start up for some users. How can I handle it that it does not run for some users?
Thanks
Mazy
No sig. available now.
|
|
|
|
|
There are several solutions. One solution is for the program to determine the active user upon startup.
Kuphryn
|
|
|
|
|
kuphryn wrote:
One solution is for the program to determine the active user upon startup.
Could you please explain it more?
Mazy
No sig. available now.
|
|
|
|
|
Use the same key but under HKEY_CURRENT_USER.
Regards
|
|
|
|
|
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
|
|
|
|