|
Hi all,
am writting a C++ application and I need to access my resource file really i use function
LoadLibrary() and it returns ahandle to the dll successfully but when I use the function
FindResource() and give it the resource id that I want to use it returns NULL, although when i use GetLastError() it tells that function endded successfully !!!.
Here I wanna tell something this code is successfull code when I use it on concole application, but when I write it on the citrix endpoint analysis SDK and generate the exe file when I run the exe simply it gives that FindResource() returns NULL,
Please can any one help???
1 - can i pass the exe name to LoadLibrary() ??
2 - FindResource problem ?? 
|
|
|
|
|
Somaiia wrote: 1 - can i pass the exe name to LoadLibrary() ??
Yes, you can pass the (path)name of an EXE to LoadLibrary().
Somaiia wrote: 2 - FindResource problem ??
Can you show the code calling FindResource()?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'd like to try vs2008.
BTW: I think the only bad thing is that it needs too much computer resources.
|
|
|
|
|
I don't think VS2008 supports source control any more, or any less, than VS2005. VSS and VSTS are the two source control solutions from MS you can plug in.
Yes, every new MS product assumes a current generation PC.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It is the rect of the selection rect of the icon, not the rect of the icon itself. How to get the rect of the icon? The size of the icon is defined arbitrarily in CImageList.
|
|
|
|
|
Hi
I've used files long time ago in C++.
I guess there is a certain new convention for using files in Visual C++ 2005,
I am using the class fstream with binary files and
I don't get the right file position when using tellp and tellg.
Is there any new class which I should use or any other method ?
I want still to work unmanaged not using the functions of system.dll which are used in .NET.
Thanks,
Clint
|
|
|
|
|
clint1982 wrote: I am using the class fstream with binary files and
I don't get the right file position when using tellp and tellg.
What do you get? Expect?
"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
|
|
|
|
|
well, I write bytes into a file, I seek to the end of the file and call (tellp or tellg) after flushing the stream, and get 2 as an answer. But if I close the file, I see that the size of the file is 188.
So I expect that the answer would be 188.
Clint
|
|
|
|
|
Usually these functions work well. Can you post the relevant code?
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.
|
|
|
|
|
I am writing a visual C++ Windows XP app for a computer that has 2 usb mice. When I receive a WM_MouseWhatever message I need to know which mouse it came from. This really has me stumped.
|
|
|
|
|
Something in my gut tells me this may not be possible with just the WM_ messages.
Perhaps if you could watch the usb port to see what goes in and out.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
When you have two mice, Windows doesn't give you two mouse pointers. It merely moves the single mouse pointer in response to whichever mouse moved. Therefore it gives no way to tell which mouse was moved.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
I needed to do something simular to handle multiple touchscreen monitors...
Have a look at Raw Input[^]...
Stormblade
|
|
|
|
|
I will take a look. In fact, I also am using two touch screen monitors, but I did not want to comlicate the question. As you know, the touch screen activity is reported as WM_MouseWhatever messages. So any additionl info you can give me to point me in the right direction would be great.
|
|
|
|
|
I am using the CFileDialog and need to know when the user deletes a file and the file he deleted. Using Visual C++ Enterprise Edition that came with Visual Studio 07.
|
|
|
|
|
You mean when you delete a file/folder from within the CFileDialog dialog ?
I don't know, but it's a good question, maybe there is an event that gets triggered that you could handle.
maybe have a look at OFN_ENABLEHOOK, OFN_EXPLORER, or OFNHookProc ?
|
|
|
|
|
For Windows 2000 Pro and above, maybe you could use FindFirstChangeNotification[^].
Note you'd have to use a separate thread to monitor changes with FindFirstChangeNotification().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I have a class, for the purposes of this message 'class AClass'. The class requires a copy-constructor for the typical purposes. The following represents what I usually do:
class AClass<br />
{<br />
public:<br />
AClass();<br />
AClass(const AClass& copy_from);<br />
<br />
...<br />
};
In my implementation 'AClass' initiates a large amount of data whilst potentially undertaking a fairly complex procedure. The entire procedure can be optimised very easily when a non-constant version of the object is supplied:
class AClass<br />
{<br />
public:<br />
AClass();<br />
AClass(AClass& copy_from);<br />
<br />
...<br />
};
However, this leads to a different problem because the 'const' keyword is no longer used. There are places within my application which must parse such objects as 'const'. So the natural solution would seem the following:
class AClass<br />
{<br />
public:<br />
AClass();<br />
AClass(AClass& copy_from);<br />
AClass(const AClass& copy_from);<br />
<br />
...<br />
};
Sadly the above produces the following warning message:
'warning C4521: 'AClass' : multiple copy constructors specified'
I know there are workarounds which involve 'const_cast', but in my application the two copy constructors need to behave differently. Also, it isn't appropriate to use pointers and references to avoid this issue because it would cause serious maintenance issues and would be too confusing.
Any help or advice would be great.
Lea Hayes
|
|
|
|
|
Hi,
Just to expand a little further...when I execute the program the correct constructor is in fact called based upon const-ness. But what I need is confirmation that this is correct well-formed C++ and that it will compile correctly on other compilers. As this is only a warning (as opposed to an error) I just want to make sure that what I am attempting is not somehow dangerous or insecure.
If it isn't dangerous (or insecure) I will just use:
#pragma warning(disable: 4521)
Thanks again,
Lea Hayes
|
|
|
|
|
lhayes00 wrote: The entire procedure can be optimised very easily when a non-constant version of the object is supplied:
Could you elaborate on that point ? That seems a bit akward to me. Maybe that would be a better solution: be able to optimise the procedure on a const object (if at all possible).
|
|
|
|
|
Without knowing how the optomization works, I am limited. If the non-const copy constructor doesn't change the source in any significant way, you might be able to declare certain members mutable . If the copy constructor destroys the source object, you might want to implement it as a swap function. In either case, I can imagine special cases that would require alternative methods.
Nathan
|
|
|
|
|
Hi,
Thankyou very much....I didn't know about the 'mutable' keyword....I can see that being very useful.
|
|
|
|
|
I don't understand, are you wanting to modify the copy_from when copying it to a new AClass ?
the AClass(const AClass& copy_from); should be sufficient; the const applies to the parameter inside the method, not outside.
You could call the copy constructor with a const AClass or a non const AClass.
for example
void SomeClass::DoSomething( const AClass& c)
{
AClass newClass = c;
}
or
void SomeClass::DoSomethingElse( AClass& c)
{
AClass newClass = c;
}
|
|
|
|
|
Hi,
The non-constant version does make changes to the copy_from object. When an object of the type AClass is returned from a method, it can be flagged.
AClass BClass::DoSomething()<br />
{<br />
AClass myObject;<br />
...<br />
myObject.IndicateReturn();<br />
return myObject;<br />
}<br />
<br />
<br />
AClass::AClass(AClass& copy_from)<br />
{<br />
if(copy_from.IsReturnIndicated())<br />
Swap(copy_from);<br />
else<br />
Copy(copy_from);<br />
}<br />
<br />
AClass::AClass(const AClass& copy_from)<br />
{<br />
Copy(copy_from);<br />
}
|
|
|
|
|
lhayes00 wrote: When an object of the type AClass is returned from a method, it can be flagged.
I have no idea what you are doing but my best guess is you have some design flaws that are causing your copy constructor issue. To achieve an optimal solution you would have to fix those flaws first.
|
|
|
|