|
You just stole a document from James! Naa too bad.
|
|
|
|
|
I haven't heard from his attorneys yet
Mark Salsbery
Microsoft MVP - Visual C++
"Thanks,I overlooked the docs."
|
|
|
|
|
Didn't you just hear from me?
|
|
|
|
|
Fixed.
Mark Salsbery
Microsoft MVP - Visual C++
"You just stole a document from James!"
|
|
|
|
|
Even funnier!
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hey what are you looking at? I just tricked him with my doc. He's just taken his hands up from your doc! Just grab it back James, fast fast.
btw, Marc is this we call a "sig-Virus",that gets itself attached to the sigs automatically?.
(Very funny indeed!)
|
|
|
|
|
Hi
you youselve have to do it in a for loop
GetSelItems()
GetText()
|
|
|
|
|
Hi all,
currently i'm developing an application with system tray icon support. now i want to display the balloon tool tips on it when some an event occurs.
and i did the application in VC++.Net 2005, it work perfectly. but i want to do in vc++6.0.
the VC++6.0 version is not supporting the latest version of shellapi.h and its related files.
can any one help me to solve this.
Thanks in advace.
Gopinath
"If you can't see the bright side of life, polish the dull side"
|
|
|
|
|
Hi,
I am trying to display a bitmap Image which I have stored in an array in my program .. But only a rectangle filled with Black color appears...My code snippet is as follows ...
<code>
HBITMAP hndle=NULL; // declared in .h file
CBitmap obj;
obj.CreateBitmap(20,23, 1, 1, dec_arr );
hndle=obj.operator HBITMAP();
sim_bt.Create( _T("Hi") ,WS_CHILD | WS_VISIBLE | BS_BITMAP , CRect(30,0,100,40),this,2222);
hndle=sim_bt.SetBitmap(hndle);
</code>
As far as I know CreateBitmap() is the function that initializes the CBitmap object with the bitmap stored in the memory ( array) [ Please correct me if I am wrong...]
Operator HBITMAP gives me the handle og the bitmap..
I am creating the button of type CButton using Create(),
and finally associating the bitmap using bitmap to the button using SetBitmap();
I have no idea of the two parameters
UINT nPlanes , UINT nBitcount ( I think these values might be causing a problem..) what values should I put here ???
If my approach is totally wrong which functions should I use..
|
|
|
|
|
It has been a while but if both are set to ‘1’ then you are creating a monochrome bitmap (black and white). How many bits per color are in the map? The article CDibData may help or you can dig through CxImage , in any case try searching for ‘image’ or ‘bitmap’ or ‘DIB’; there are lots of acticles.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Ravindra_Joshi wrote: UINT nPlanes , UINT nBitcount ( I think these values might be causing a problem..)
You set both to 1, and MSDN states :
For a color bitmap, either the nPlanes or nBitcount parameter
should be set to 1. If both of these parameters are set to 1,
CreateBitmap creates a monochrome bitmap. Hence the black rectangle. I would try leaving nPlanes to 1 and setting nBitcount to a higher number. I am sorry to have no more advice to give on the real usage.
|
|
|
|
|
If I put the values of nBitcount and nPlanes other than 1 , then nothing is displayed ( not even the rectangle filled with black color ).....
Can someone help me out with the values of "nPlanes" and "nBitcount" ....
|
|
|
|
|
>>HBITMAP hndle=NULL; // declared in .h file
>>CBitmap obj;
>>
>>obj.CreateBitmap(20,23, 1, 1, dec_arr );
>>
>>hndle=obj.operator HBITMAP();
>>
>>sim_bt.Create( _T("Hi") ,WS_CHILD | WS_VISIBLE | BS_BITMAP , CRect(30,0,100,40),this,2222);
>>
>>hndle=sim_bt.SetBitmap(hndle);
The planes and bitcount describe the format of the pixel data in the array.
nPlanes is the number of planes and nBitcount is the number of bits per pixel per plane.
These define the layout of the data in the array, where each row of pixel data is followed by the
next row of data for each plane.
Each row of pixel data bytes must be WORD aligned for a CBitmap/HBITMAP. That means every row
needs to have a length a multiple of 2 bytes, padded if necessary.
Some examples:
For a 16x16 bimap nPlanes==4, nBitcount==1 the data is layed out in the array<br />
Plane 0, Row 0 2 bytes<br />
Plane 0, Row 1 2 bytes<br />
...<br />
Plane 0, Row 15 2 bytes<br />
Plane 1, Row 0 2 bytes<br />
Plane 1, Row 1 2 bytes<br />
...<br />
Plane 1, Row 15 2 bytes<br />
...etc
For a 16x16 bimap nPlanes==1, nBitcount==24 the data is layed out in the array<br />
Plane 0, Row 0 48 bytes<br />
Plane 0, Row 1 48 bytes<br />
...<br />
Plane 0, Row 15 48 bytes
You seem to know your array of pixel data is for a 20x23 bitmap.
You also need to know the format of that data, and if it's not a format supported by GDI you may
also need to translate it into an acceptable form.
You also don't need to call a conversion operator specifically like you've done to get the HBITMAP
from a CBitmap. You can simplify your code:
HBITMAP hndle=NULL; // declared in .h file
CBitmap obj;
obj.CreateBitmap(20,23, 1, 1, dec_arr );
sim_bt.Create( _T("Hi") ,WS_CHILD | WS_VISIBLE | BS_BITMAP , CRect(30,0,100,40),this,2222);
hndle=sim_bt.SetBitmap(obj );
Hope this helps a little!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Hello, I have a global header file called TypeDefs.H, this file is included in header file of every class of my project. because all classes use custom types. Now I have a class called CMyData which is also a member of some structs in TypeDefs.H, so I have to include MyData.H in TypeDefs.H
problem is some members of CMyData are custom and defined in TypeDefs.H so I also have to include TypeDefs.H in MyData.H
I agree that it may seem ugly but in this way I can keep things organized in my brain, but compiler dose not like that and shouts loudly with thousands of error messages. I even tried
to use
<br />
#ifndef MY_DATA_H_<br />
#define MY_DATA_H_<br />
...<br />
#endif<br />
in MyData.H
and
<br />
#ifndef TYPE_DEFS_H_<br />
#define TYPE_DEFS_H_<br />
...<br />
#endif<br />
in TypeDefs.H
but problem persists
can someone kindly tell me how can I get over this problem
|
|
|
|
|
I suggest that you use a combination of 2 approaches depending on the types, classes or non class types, you're defining.
1. A third header file e.g. BaseTypes.h which contains the definitions out of MyData.h and TypeDefs.h that don't depend on anything else. You can include this file from both MyData.h and TypeDefs.h and this should remove some of your problems. If you still find both header files are dependent on one another you might want to actaully draw out a dependency tree to work out how to further divide your files.
2. Use forward delclaration to introduce names to the compiler before you define them. Remember that you can only use the forward declared name in places where the size of what it refers to is not an issue for the compiler like declaring a pointer.
class CMyAwkwardClass;
class CSomeOtherClass
{
private:
CMyAwkwardClass* m_pAwkward;
};
Careful use of this sort of thing may get you out of a hole.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew, Do I have to destroy CMyAwkwardClass* m_pAwkward manually when exiting the program to prevent memory leakage? Thanks
|
|
|
|
|
Electronic75 wrote: CMyAwkwardClass* m_pAwkward manually when exiting the program to prevent memory leakage
Only if you initialize it using the new operator or a copy constructor or ..., not if it is only used as a pointer.
|
|
|
|
|
Rage wrote: Only if you initialize it using the new operator or a copy constructor or ..., not if it is only used as a pointer.
Hey Rage, that's the pointers! it needs to be initialized with "new", otherwise they point to nowhere and so need the "delete" then. Rather you meant the variables that get allocated on stack? like CmyClass myCls;
Just got the context.
-- modified at 14:40 Thursday 19th July, 2007
|
|
|
|
|
Memory management is a whole other issue. When exiting the progrma Windows throws everything away anyway. Still when you've finished using anything m_pAwkward points at you should delete it.
Every m_pAwkward = new CMyAwkwardClass(); needs a matching delete m_pAwkward; . Remember that means matching in terms of the calls actually made at runtime not just the text of the source code. Enjoy.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I have a executable package. How can I make an installation package of this executable package that will automatically run when window start running or reboot? Have I write any code for this in the source code? Please help......
|
|
|
|
|
I am doing direct disk IO on a Compact Flash card (using Win32 CreateFile API) which is connected to the PC via a USB flash reader.
This card is mapped to my machine as a "device with removable storage" and has the drive letter H:
On some other machine, Windows will map it with some different drive letter (e.g. I, K etc).
I don't want to hard code the drive letter H: or K: in my code, rather want to automatically detect that H: or K: is my desired drive. How can this be done?
Can anyone help? Pardon me if this is a stupid question as I am new to C++ and Windows programming.
Thanks
dranne
|
|
|
|
|
Look at following code project article
http://www.codeproject.com/w2k/usbdisks.asp?df=100
I hope it helps.
|
|
|
|
|
Is ur Application (which has to perform the disk IO) installed on the PC or on the USB flash reader ?
If the Application runs from the PC (rather than from the USB flash drive) is there a posssible scenario of mutliple USB flash drives are connected to the PC and u have to uniquely identify each USB flash drive and perform a different disk IO ?
Vipin.
|
|
|
|
|
I created a Dialog-based application and overriden CWinApp::OnIdle() but the focus is not coming inside the function. How to make the focus when the application don't have any message in message queue. I want to do this because, one acknowledgement message from H/W via USB port is missing between end of OnInitDialog() and display of dialog.
I want to check the message queue in OnIdle() .
Any help would be greatly appreciable!!
Best Regards,
Suman
|
|
|
|
|
See here[^]
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|