|
You tried the SetWaitableTimer api?
It doesn't need a message pump.
Cheers,
Joao Vaz
|
|
|
|
|
|
Is there a way to determine how many separate bitmaps there are within a .bmp-file (e.g. one used for a toolbar). I like to find out the width and hight of every bitmap.
Thanks in advance,
Aart
|
|
|
|
|
Usually in a bitmap like this, all o fthe sub-bitmaps are the same size, so you could simply find out the width and the height of the bitmap in the header of the bmp file, then divide the smaller of the width and the height into the larger number, and that will tell you how many images are in the entire file.
Then the dimensions of the sub-images will be the smaller number for one dimension, and the larger number divided by the number of images in the file.
|
|
|
|
|
Hi Gurus!
Couuld you write me please the address, where I can download the SDK?
-George
Das war kein Heldenstueck, Octavio!
|
|
|
|
|
|
I was compiling this app tonight in release mode...multithreaded, statically linked. os is xp using vis studio .net
I went to test it out on my 2k box and got a dll error referring to msvcr70d.dll, msvci70d.dll, and mcvcp70d.dll.
would the user 'need' to have these dll's installed(in which case it does work)? or is there another way around this?
Basically, I'm just looking to have one executable to hand out and not all the accompanying dll's. I was under the impression if i 'statically linked' it the exe would not be dependant on those. Why wouldn't i just use a 'dynamically linked' solution; keeping the exe size down even further and sending along the dll's anyway?
also, i do have the dll's on my xp system....I assume from when i installed vis studio and they're not on the 2k machine.
Any elaboration into my dilemma would be greatly..GREATLY appreciated.
thank you,
gus
|
|
|
|
|
Are you 100% sure you are statically linking your app? I mean, those DLLs look like C run-time library DLLs. I'd suggest you thoughoughly check your app is actually being statically linked. Also, if you have any other project without this problem you could check what its settings are and try to find the differences.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You didn't test with the release version, but the debug version. The trailing d in the DLL names indicates they're the debug versions.
--Mike--
"There are only a limited number of jobs where they will ask to see the sausage. Most of them are in movies."
-- Christian Graus, 2/11/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
thanks for the tip. I tried creating a new project config (because the one i was using was imported from vis studio 6) and then change to 'statically link'. compiled, ran it and the same thing. below is the config settings if that helps.
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2">
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
StringPooling="TRUE"
MinimalRebuild="FALSE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
Name="VCLinkerTool"
AdditionalDependencies="id3lib.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="FALSE"
Is there one or more specific settings i should check to make sure it's statically linked? I'm using mfc and have that setting statically linked. I'm not sure of what others i would have to check. any ideas?
thanks again,
Eric
|
|
|
|
|
Mike,
I wanted to thank you for your help and 'tip'. I had an inkling that the trailing 'd' was a debug version but i couldnt understand why. what was really valuable was one of your faq articles....mentioning 'depends'. i loaded my exe in and none of the requested dll's were mentioned... however...there's a dll that i link to that DOES. turns out that i compiled it in debug mode. anyhow, i switched it over to release and reran my app. i still get the dll warning but this time they are not the debug versions(no trailing 'd'). Is there a way not to rely on those? i have the settings in the dll project to statically link as well.
if i compile the dll on a nt4 box they now will depend on older versions of the dll's. this method works just fine since most will already have them.
Eric
|
|
|
|
|
C:\Windows\Desktop\Project2\Project.cpp(759) : warning C4101: 'exception' : unreferenced local variable
|
|
|
|
|
You may safely ignore the warning.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
you defined a variable called "exception" on line 759 of project.cpp. You never bothered using it.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I would like to write a function in C++ and compile that into a .dll that I can access within Visual Basic. The purpose behind this is a company restriction and I feel the process can be handled most efficiently in the C++ environment. Does anyone know what I would need to do to compile it as such.
Here would be an example, but not my particular function:
int SumValue(int a, int b)
{
return a + b;
}
Thanks in advance
Nick Parker
|
|
|
|
|
COM is really the only way you can do this. I'm not much of a VB expert, but to get a function pointer in a DLL requires pointer support, which VB doesn't have. Therefore, you're going to need to create a C++ COM object with a method called SumValue. You should then be able to use this in VB.
You should be able to find plenty of articles about how to create a simple COM object on this site.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I've created what I believe should be the method to do this:
1. Created a Win32 Dynamic Linked Library
a. Choose a simple .dll project
2. Wrote the function inside the header file.
3. Compiled the .dll ok and exited VC++
Launched VB
1. Added a module
2. Included the following code for the module
Declare Function SumValue Lib "sum.dll" (ByVal a As Integer) As Integer
3. Put a button on a form where I try to call the function SumValue
4. Get an error:
Run-time error '453' Can't find DLL entry point SumValue in sum.dll
Does anyone have a clue?
Thanks again
Nick Parker
|
|
|
|
|
I believe VB supports __stdcall functions from DLLs (like nearly the entire Win32 API). Try adding these lines to your function :
__declspec(dllexport) __stdcall int SumValue(int a, int b)
For my code I have a DllExport macro. If I were you I would probably make a macro to handle all of the above.
My jokes page
|
|
|
|
|
The function that you just wrote should be written like this to export it from the DLL.
__declspec(dllexport) __stdcall int SumValue(int a, int b)
{
return a + b;
}
dllexport exports it from your dll, and __stdcall is the calling convention that VB accepts. _cdecl is the default calling convention therefore if you just simply exported your function from the DLL and used it in VB, you program would probably crash.
In you VB program, at the top of the file that you would like to call this DLL, you will need to make this declaration.
Declare Function SumValue& Lib "yourdll" (ByVal a as Integer, ByVal b as Integer)
After this you should be able to use your function in VB.
|
|
|
|
|
Some articles and samples on writing DLLs in C++ for use with VB by Bruce McKinney:
http://www.vb-zone.com/upload/free/features/vbpj/1999/mckinney/CppForVB.zip
(sorry, its a ZIP, i cant seem to find the HTML online)
--
David Wengier
|
|
|
|
|
ostream& operator << (ostream& s, Stocks& stocks)
{
for(int i = 0; i <stocks.numofstocks; i++)
="" {
="" s="" <<"stock="" information:="" "<<="" (stocks.mystocks[i]).getcompanyname()<<"="" "<<stocks.mystocks[i].getstockticker()<<"="" "<<stocks.mystocks[i].getmarkettraded()<<"="" "<<stocks.mystocks[i].gettypeofmanufactr()<<"="" "<<stocks.mystocks[i].getinitialvalue()<<"="" "<<stocks.mystocks[i].getnumofoutshares()<<endl;
="" return="" s;
="" }
}
i="" really="" should="" not="" use="" any="" other="" classes="" but="" the="" <string.h=""> and <iostream.h>
in my project, so if you can tell me how to get this method to work, i know that my return statement should not be inside the body loop
but how do i fix it?
by the way this method is in a class called Stocks that holds an array of the class objects Stock. and the class Stock defines this method as well but ithout any loop.
our teacher was saying that when we try to use this method in Stocks class it will automatically call the same ostream method in class Stock
can any one tell me how is that?
|
|
|
|
|
no other classes can be used in this project!
thank you
|
|
|
|
|
:\Windows\Desktop\Project2\Project.cpp(253) : warning C4715: 'operator<<' : not all control paths return a value
C:\Windows\Desktop\Project2\Project.cpp(387) : warning C4715: 'operator<<' : not all control paths return a value
here are the warnings it was giving me.
|
|
|
|
|
Firstly, if you are using the < character in your message, you should check the "Display this message as-is" box so that the HTML doesn't get mangled.
Marwan wrote:
our teacher was saying that when we try to use this method in Stocks class it will automatically call the same ostream method in class Stock
can any one tell me how is that?
OK, I think what your teacher is saying is that if you have two classes:
class Stock
{
...
ostream& operator << (ostream& s, Stock& stock);
};
class Stocks
{
ostream& operator << (ostream& s, Stocks& stocks)
Stock *m_aStocks;
}
then in the << operator of the Stocks class, you don't need to output all the individual members of each Stock object. Rather, the Stocks class should go through all the Stock objects, and call the << operator on the Stock class. Then, the << operator on the individual Stock class should output all the elements of Stock.
What this means is that the loop in the code you quoted shouldn't have a return statement inside it. You need to return once the loop is finished. Also, the << operator for Stocks shouldn't be << each element of each Stock.
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Your teacher wants you to read two topics:
(1) operator overloading
(2) polymorphism
Although I personally can give you a complete answer to your question (as I have given similar question to my students) but I believe that if you simply read the above mentioned topics you would be able to solve the problem yourself.
Basically the "Stock" object has an implementation of "<<" operator that outputs the conctenated string containing the attributes of Stock object
The "Stocks" object will have its own "<<" which uses the "<<" of Stock to produce a consolidated string that shows the details of ALL the stocks.
You have already noticed that the return from with in the loop will give you an error. Since you for () condition is not properly shown (due to HTML format) i can't really see why u are returning from with in the loop - because this way your loop will only run once (but i guess u already know this).
-cheers,
kashif manzoor
peace to all
|
|
|
|