|
Hi Arman,
I found out the solution for error C2504: 'AnyObject' : base class undefined
My tlb is dependent on some other tlb so, what i did is I #import the base tlb before importing my tlb. It complies fine. There are no errors.
But, I am not able to get pointer to my COM object, when I am running following sample code
CoInitialize(NULL);
IMyComObject pObject(_uuidof(MyComObjectName));
I am getting following error in CoCreateInstance method
0x80040154 Class Not Registered
I checked the registry, there is an entry for my typelib.
I am not sure why it is not able find the class.
Any suggestions/help please..
Thanks in advance
JK
|
|
|
|
|
Is it possible to use resources with subclassed controls? If so, how? After creating a control with hControl = CreateWindow( ... ), is there a function I can call that will use a resource to format it (or a different function to use besides CreateWindow)? I only know how to use resources with menus and dialog boxes at this point. I've looked through many examples and I've tried many searches, but I've yet to see this done. As such, I'm asking the question here.
|
|
|
|
|
I'm not sure what you mean here.
Have you subclassed an existing Windows common control or do you have your own window class,
which isn't a subclass?
And by resources, do you mean a custom control on a dialog resource?
Assuming you do mean a control on a dialog resource...
For a subclassed Windows common control, you use the common control class on the dialog and
subclass it after the dialog is created, which is the only time you can subclass it - when the control actually exists.
For a custom window/control class on a dialog, you can place a "Custom Control" (from the toolbox in the dialog editor)
on the dialog. Then in its properties, set the appropriate values, especially the window class. This window class will need
to be registered when you create the dialog or dialog creation will fail.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: I'm not sure what you mean here.
I think he means like he want's a filet-o-fish with no special sauce.
led mike
|
|
|
|
|
Hmm... After doing some more research, perhaps a more relevant question would be: Is there a UI for organizing the main window? As in, the window that pops up in a basic Win32 Application, and not a dialog box.
I don't need help creating dialog boxes, as those are relatively easy. However, inserting controls in the main window is more difficult. I'd like a way to organize this main window with a resource file (.rc) or just a UI in general. Right now, I'm coding everything by hand, which is fine, but I was wondering if there was an easier way to do this.
As you can probably imagine by now, I'm quite new to programming Win32 applications. I don't really like popups, but dialog boxes are much easier to make, so right now I'm considering making my application just open a dialog box that looks exactly like a regular window, though I don't know if this would be particularly easy, either. The best-case scenario would be an easier interface for editing the main window, which I've yet to find in VC++ (I'm using 2008 Pro).
|
|
|
|
|
I don't know of any UI tools for laying out child windows on a parent window.
If a dialog window suits your needs, you don't have to use a popup-style dialog.
You can make a dialog resource which is a borderless, child style and position it
within the client area of a regular window, which can be any style you want.
In the window containing the dialog, you could create the chhild dialog (modeless) in response to the
WM_CREATE message. In response to WM_ERASEBKGND you would do nothing (making the window "transparent"
and preventing flicker. In response to WM_SIZE, position/resize the child dialog to fit the entire client area of
the window.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi every one!
as you likely know, using above API, we can get a globally unique identifier (GUID) string.
My question is will this string remain unchanged for ever? I thought maybe it changes after each change in hardware or in any other reason
|
|
|
|
|
So are you struggling with the meaning of the word "current"?
led mike
|
|
|
|
|
Usef Marzbani wrote: My question is will this string remain unchanged for ever?
Yes, plus an extra day just to be safe. Of course this assumes your hardware profile does not change!
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Rumour has it that GUIDs will start duplicating starting from year 3000.
--
=====
Arman
|
|
|
|
|
i need c++ code for aprogram that find e^0.5 using taylor formula with tolerance of 0.05%.
knowing that taylor formula for e^x=1+x+x2/2!+.......+x^n/n! plzzzzzzzzzz i need this code if any one could help me and thanx alot. aneet it before this monday plzzzzzzzzz
eva
|
|
|
|
|
If you are not Kyle we care even less. I realize you have no idea what I am talking about because you have not read any of the posting guidelines for the site. Good luck with your studies and homework assignments. It's seems you will need it.
led mike
|
|
|
|
|
I cannot guarenee its right, you will have to debug it yourself, but something to get you started
#include <math.h>
int main(void)
{
double current = 1;
double old = 0;
int n = 1;
int factorial = 1;
while(fabs(current - old) > 0.05/100)
{
old = current;
factorial *= ++n;
current = pow(old, n) / factorial;
}
}
|
|
|
|
|
Well, you know the formula...What is your trouble about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I need to command line program that starts other command line applications in their own window.
I can use spawn or ecec to run the programs but they run in the main window, not their own. I tried using ShellExecute, but I got a linker error. Does a DOS terminal window have a program name I can call using system or spawn?
Any suggestions?
Thanks
|
|
|
|
|
malaugh wrote: but they run in the main window, not their own
use CreateProcess[^]and set CREATE_NEW_CONSOLE in their process creation flag.
|
|
|
|
|
Thanks. FYI I found another method. If you open a cmd window and type "start myprogram.exe", the program will start in another window, so in my program I used:
system("start myprogram.exe");
I will your method also and see which works best.
|
|
|
|
|
malaugh wrote: I tried using ShellExecute, but I got a linker error.
Did you link with Shell32.lib? If so, what was the linker error?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My mistake, I must have coded it wrong the first time. I tried it again using:
ShellExecute(0,0,"myprogram.exe",0,0,SW_SHOWNORMAL);
and it worked. I sued a more complex example last time, must be something to do with the options.
|
|
|
|
|
Hi!
I've been searching the Internet on how to detect if somebody are using any shared folder on my computer.
My little app is a small remotely programmable server I have to start video recordings computer. It shuts down the computer automatically
if no recording is to be done within 2 hours. However, I don't want
it to shut down while downloading.
No my question. How do I detect if I (or somebody) is using any shared folder? I've been searching everywhere without any luck. To be honest
I really don't now exactly what to search for.
TC
|
|
|
|
|
Member 2419650 wrote: I've been searching the Internet on how to detect if somebody are using any shared folder on my computer.
Such as NetConnectionEnum() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes that was exactly what I needed.
Thank you very much.
|
|
|
|
|
Hi, may I ask you some personal suggestion?
I have a FILELIST class, containing a list of "file-objects" (doens't matter what they really are).
I expect that all of these function could be useful
char* getFileNames() ; //Returns a string containing file names appended to each other with a
//certain separator
string getFileNames() ; //The same as above, but using <string> class (maybe the least useful)
vector<string> getFileNames(); //Returs a vector of strings, each one containing a single file
As I can't overload functions with different return types (that's right?), I need to name
them in different way.
Do you have suggestions?
getFileNamesAsChar? getCharFileNames? getFileNames_char? char_getFileNames?
getFileNamesVector?
Unleash your fantasy, and help me in finding a good style..
|
|
|
|
|
How about something like:
class FILELIST
{
public:
getFileNames(char *);
getFileNames(string);
getFileNames(vector);
};
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Adding to other reply, since your class is already a list why you create a list in other forms (char *, string, vector) every time in the function call getFileNames() instead giving functioality to the class to get element of list will be useful.
class FILELIST
{
int size(); // returns number of elements in list
char *getName(int pos); // return the string corresponding to position in list.
// iterator
char *getFirst();
char *getNext();
};
or how about making use of STL itself;
typedef vector<string> FILELIST; or
typedef vector<char *> FILELIST;
or
class FILELIST: public vector<string>
modified on Friday, March 21, 2008 9:44 AM
|
|
|
|