|
Jay Hova wrote:
can you tell i am new to programming?!?!?!
Not unless you tell us! Even experienced folks forget stuff now and then.
|
|
|
|
|
I want get a associated icon from a file system (for example c:\test.doc") using SHGetFileInfo function and save it in a file (for ex "C:\myicon.ico").
But GlobalSize and GlobalLock returns 0 (invalid value!!!).
I've read an IconPro example (in vs6example.exe) but I didn't found a good solution!
Please give me a good idea!
Tnk you
/******MY CODE*****/
CString nomefile = "c:\\test.doc";
HICON hGen32Icon;
HIMAGELIST hSysImageList;
SHFILEINFO shfi;
int fh;
UINT uiSize;
DWORD dwSize;
LPVOID lpGMem;
OFSTRUCT of;
hSysImageList = (HIMAGELIST)SHGetFileInfo
(nomefile,
0,
&shfi,
sizeof (SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
hGen32Icon = ImageList_GetIcon (hSysImageList,
shfi.iIcon,
ILD_NORMAL);
dwSize = GlobalSize(hGen32Icon); /*Don't work*/
lpGMem = GlobalLock(hGen32Icon); /*Don't work*/
fh = OpenFile ("c:\\myicon.ico", &of, OF_WRITE | OF_CREATE);
if (fh == -1) // If NOT opened successfully.
{
MessageBox("Unable to create file", NULL, MB_OK );
}
uiSize = _lwrite(fh, (LPSTR)lpGMem, (UINT)dwSize);
_lclose(fh);
|
|
|
|
|
Hi Dears
Kindly Tell me How to run a script (.vbs) in VC++, Please help ....
I'll very be thankful
Atif
Watch Your Thoughts for they will become your actions.
Watch Your Actions for they will become your habits.
Watch Your Habits for they will become your beliefs.
Watch Your Beliefs for they will determine your destiny.
|
|
|
|
|
|
hello
i want to use edit boxes in userdrawn list box control. can anybody help me in this matter. i would also like to know how to comunicate with it after creating userdrawn editlist boxes
thanking you
chan
|
|
|
|
|
I want to draw a picture , in which one color must not be drawn,
-transparent color,
but at usual samples I must redraw picture fully transparent - get background,
repaint at transparent places,
and than only paint picture.
Here I must REALLY redraw more one time full place- that is visible like flickering.
Is it possible to redraw trabsparent bitmap with no repaint?
Or is there e else method without flickering?
(BeginDraw()
EndDraw() -do this? )
Does standart dc.TransparentBlt() draw with no flickering?
thanks you
|
|
|
|
|
You could draw the background onto a memory dc, draw your transparant picture to there, then bitblt to the screen, and handle WM_ERASEBKGND there ofcourse to prevent the flickering.
|
|
|
|
|
But how can I get background - if not repainting my picture
invisible first?
That is problem!
|
|
|
|
|
he means draw ur background image into a memdc THEN draw ur transparent image over it into the same memdc (avaoiding drawing the color u dont want to see) then bitblt it to the screen
if u dont have a background image u want to see underneath the transparent image why bother with transparency?
hope that helps
"there is no spoon" biz stuff about me
|
|
|
|
|
fisrtly how do i make arrows, lines, circles or squares objects that i can
cut and paste and copy, then with that it would help me being able to save the diagram in xml, but not in diagram format but in code. this will help me
edit the loaded version of the diagram, ie cutting and pasting lines and squares that were loaded from a saved diagram....an argoUML use case project
smile...its your destiny
|
|
|
|
|
Please clarify. Do you want to write a program that lets a user draw lines and arrows that can be edited and be saved to XML?
|
|
|
|
|
I created red bimap,(0000FF)
get it's pixels by following code,
but method showes pixels is blue (FF0000):
How order of colors and bytes myst be read to make getting color
and place of pixel correct?
<br />
BITMAP bm ;<br />
DWORD* pBits;<br />
<br />
GetObject(hBitmap, sizeof(BITMAP), &bm);<br />
<br />
pBits= new DWORD[bm.bmHeight*bm.bmWidth];<br />
<br />
memset(pBits, bm.bmHeight*bm.bmWidth ,0);<br />
<br />
<br />
GetBitmapBits( hBitmap, (bm.bmHeight*bm.bmWidth*4), pBits );<br />
<br />
COLORREF* pCr;<br />
int bt_cr = bm.bmBitsPixel/8;
<br />
<br />
for(int h =0; h < bm.bmHeight; h++)<br />
for(int w =0; w < bm.bmWidth; w++)<br />
{<br />
<br />
<br />
pCr = (COLORREF*) & ((BYTE*)pBits)[ w* bt_cr + h*bm.bmWidthBytes ];<br />
<br />
<br />
BYTE pureR,pureG,pureB;<br />
pureR =GetRValue(*pCr);
pureG =GetGValue(*pCr);
pureB =GetBValue(*pCr);
<br />
|
|
|
|
|
Each pixel has BGR format. I know this from bitmap displaying in OpenGL.
yiy
|
|
|
|
|
Right answer is:
to a 32 bit dib, the order is XRGB.
to a 24 bit dib, the order is BGR.
But to a 16 bit dib, there are two types.
X555, 565. I don't know which one is correct or which one should be by given a dib. Maybe who can tell me.
http://www.codeguru.com/forum/showthread.php?s=&postid=799709#post799709
|
|
|
|
|
Each pixel is COLORREF value. sizeof(COLORREF) is 24.
24/3=8. It means, that you can describe each pixel with three 8-bit values. So, naturally, you have only 24-bit dib in bitmap pixel array. And it is true.
yiy
|
|
|
|
|
8-bit and 16-bit dibs are indexed, they are not rgb values. Read all about them in the Petzold.
|
|
|
|
|
I do not works with DIB,
just need correctly proceed 24 and 32 bit BITMAPS only.
Do you think despite all samples did for bitmap,
DIB much better dor speed and suitability?
|
|
|
|
|
just need correctly proceed 24 and 32 bit BITMAPS only.
Well yeah but you mentioned 16-bit bitmaps so I figured I'd correct that...
As for ddb vs dib, I find it easier to work with ddb's (they're faster too) but when you have a very large bitmap you may run out of video memory... It all depends on your application, basically.
|
|
|
|
|
Hi everyone,
I wanted to know if someone could help me. I have a project with three different classes for three different dialogs(3 .cpp files). I have a variable that the user enters, which is in one of the classes (dialogs). I want to use that same variable with the stored information in my other dialog(class). How do I do that?
Someone told me to pass a pointer, but i don't know how to exactly do that cause i get some error when i run the program.
Thanks for helping me.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
1) You can declare your variable in global scope.
2) You can use pointer to the variable in the first class in the last two classes.
yiy
|
|
|
|
|
How would I use a pointer to the variable in the class so that the other classes could use it? Can you help me with this. I am new to programming, and am trying to teach myself with a book. (i'm only 15)
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
I think, that the better way to do this is declare m_var as static variable. After that you can use this variable as CL1::m_var.
------------------------------------------------------------
class CL1
{
public:
CL1(); //constructor
virtual ~CL1(); //destructor
public:
static int m_var; //your variable
public:
void SetVariable(int value)
};
CL1::m_var=0; //linking will fail without this.
CL1::Cl1()
{
}
CL1::~CL1()
{
}
void CL1::SetVariable(int value)
{
m_var=value;
}
#include <iostream.h>
using namespace std;
int main()
{
CL1 myclass;
int user_val;
cin>>user_val;
myclass.SetVariable(user_val);
cout<<"After input "<
|
|
|
|
|
Hello,
the following should work:
In the dialog class add the following:
private:
VarType m_Var;
public:
VarType GetVar() {return m_Var;}
In the other classes at a point where you want to use the var add
VarType var = YourClass.GetVar();
this should do the trick!
Good luck!
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi,
I have a list of _bstr_t, and I'm trying to sort it using the cool features of STL ( this pred method, to make the sort I need an special compare, first removing two characters), my code looks something like:
Definition:
<br />
typedef std::list<bstr_t> CList;<br />
<br />
CList m_Files;<br />
<br />
bool pred(const bstr_t &x, const bstr_t &y);<br />
Predicate: ( just some silly test first)
<br />
bool pred(const bstr_t &x, const bstr_t &y)<br />
{<br />
return true;<br />
}<br />
Call:
<br />
std::sort(m_Files.begin(), m_Files.end(), pred);<br />
And the error that it gives me:
error C2784: '_Distance __cdecl _STL::operator -(const class _STL::reverse_iterator<_RandomAccessIterator,_Tp,_Reference,_Pointer,_Distance> &,const class _STL::reverse_iterato
r<_RandomAccessIterator,_Tp,_Reference,_Pointer,_Distance> &)' : could not deduce template argument for 'const class _STL::reverse_iterator<_RandomAccessIterator,_Tp,_Reference,_Pointer,_Distance> &' from 'struct _STL::_List_iterator<class _bstr_t,s
<="" small="">
, I know... all the thing that only have three letters are not compatible between them... ATL ... STL ... MFC... COM
Thanks in advance, greetings
|
|
|
|
|
If CP hasnt filtered out your template parameters, then you need to do something like this:
typedef std::list<CString> CList;
Apologies if this is what you entered initially!
|
|
|
|