|
vikas amin wrote: WORD bfType=0; // must be 'BM'
DWORD bfSize=0; // size of the whole .bmp file
WORD bfReserved1=0; // must be 0
WORD bfReserved2=0; // must be 0
DWORD bfOffBits=0;
You cannot init members like that inside a structure.
Create an instance and then initialize the members
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
to be more complete, writing such a thing tell the compiler that the members are pure virtual (which is here definitely wrong).
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Game over
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
in the constructor , init the strcut variable = {val,val2,...).(positional refernce)
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
Mr vikas,
it's the second time i see this question from you. if you continue asking it exactly the same way, you will get exactly same answers...
to go further in help, i'd like to see how you exactly try to initialize your struct (give a piece a code were you do it, and DON'T FORGET : round your code samples with <pre></pre> tag to help us see you code better !!)
moreover, as it has already been suggested, there are 2 ways to do this :
1st :
m_BITMAPFILEHEADER = { 0, 0, 0, 0, 0 };
2nd :
m_BITMAPFILEHEADER.bfType = 0;
m_BITMAPFILEHEADER.bfSize = 0;
m_BITMAPFILEHEADER.bfReserved1 = 0;
m_BITMAPFILEHEADER.bfReserved2 = 0;
m_BITMAPFILEHEADER.bfOffBits = 0;
if you try to initialize this in your class constructor, did you try also to use the first method in the initilizer list of the constructor ?
<font color=blue>class</font> MyClass {
<font color=blue>private</font>:
<font color=blue>struct</font> tagBITMAPFILEHEADER {
<font color=green>
tagBITMAPFILEHEADER(<font color=blue>const</font> tagBITMAPFILEHEADER&); <font color=green>
} m_tagBITMAPFILEHEADER;
<font color=blue>public</font>:
MyClass()
: m_tagBITMAPFILEHEADER({ 0, 0, 0, 0, 0 }) {
<font color=green>
}
};
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
You could write a constructor into the structure itself, so whenever that structure is created, it's properly initialized:
struct tagBITMAPFILEHEADER
{
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfOffBits;
tagBITMAPFILEHEADER::tagBITMAPFILEHEADER()
{
bfType = 0;
bfSize = 0;
bfReserved1 = 0;
bfReserved2 = 0;
bfOffBits = 0;
}
};
Now you could have in your header:
tagBITMAPFILEHEADER *m_pBMHeader;
and when you create it
m_pBMHeader = new tagBITMAPFILEHEADER;
the constructor will be called and your values will be initialized.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I want to offer a user a list of folders to choose from. The user should be able to use the arrow keys to scroll up and down so that the current choice is highlighted. They should also be able to choose using the number keys.
Thanks
KevinSheedy
|
|
|
|
|
To get a list of folders, you could use _findfirst() , _findnext() etc to get the needed folder list.
A- Display the list using printf() , cout etc.
B- Write a while loop which takes input from the user, and interprets the key pressed. (you could use getch() ).
C- Highlight the current selection. (Now that is a problem):
1- You could put some special character ahead of the selected line.
2- You could dig deep into VC and find just the right technique to change the backcolor of the text, or the text itself. (If it is possible)
3- Something else.
Is that your homework?
this is this.
|
|
|
|
|
Hi. Thanks, that helps. I guess the highlighting part isn't all that important. You know when windows gives you the option to boot from safe mode, safe mode with CD support or boot normally etc. It lets you scroll up and down with the arrows. I just thought there might be some simple function that lets you do that. If there's no easy way, I can just prompt the user to pick a number or something like that. It's not worth wasting too much time over.
KevinSheedy
|
|
|
|
|
Just a little comment:
The windows menu that appears comes from real-mode DOS (I think) So, there are endless possibilites of what you can do with real-mode DOS OS; you can write directly to memory, set the foreground and background colors, blink text, ... anything. But with protected mode OSes, they don't let you write directly to any arbitrary memory location.
this is this.
|
|
|
|
|
Just adding to what Khan++ said. Programming for the DOS window is a different programming style than the even driven windows framework. If you used to program in Turbo C++, there used to be a library (conio.h) that allowed you to manipulate the console window. But you still had to do the hard work if you wanted to simulate UI things like menu selection.
You can still do this in a Windows Console program using the console functions. Take at look at this[^] to start with.
I Dream of Absolute Zero
|
|
|
|
|
Hi,
Here is the code ,what i am using
HMODULE hmod;
HRSRC hr;
HGLOBAL gm;
char* lock;
hmod=LoadLibrary("testdll.dll");
hr=FindResource(hmod,MAKEINTRESOURCE(504),"GIF");
gm=LoadResource(hmod,hr);
lock=(char *)LockResource(gm);
if(hr == NULL)
MessageBox("This is not working");
else
MessageBox("This is working");
Here ,in this testdll.dll, we have stored Gif file as a resource and 504 is the resource identifier number. The resource type is "GIF".
But its not working. plz suggest me the solution
--
Regards,
RamakoteswaraRao Koti
spend every minute for success
|
|
|
|
|
I can not remember exact code, but the fuction call
hr=FindResource(hmod,MAKEINTRESOURCE(504),"GIF");
is not correct.
you can try enumurating resource to find its resource ID.
includeh10
|
|
|
|
|
How can I add a status bar to a dialog.
I can add a toolbar but status bar is not showing up. It is being created successfully.
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
LOL
I've Done It.
He he.
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Try using InitCommonControls or InitCommonControlsEx in the beginning of your program.
INITCOMMONCONTROLSEX InitCtrls;<br />
InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);<br />
InitCtrls.dwICC = ICC_BAR_CLASSES; <br />
InitCommonControlsEx(&InitCtrls);
If it still does not work, you should try to add it through code:
hStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL,<br />
WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0,<br />
hwnd, (HMENU)IDC_MAIN_STATUS, GetModuleHandle(NULL), NULL);<br />
int statwidths[] = {100, -1};<br />
SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);<br />
SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)"Some text");
kind regards,
Ward
|
|
|
|
|
Here the well known Nish article :
Link[^]
~RaGE();
|
|
|
|
|
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hi,
(1) I have a CRszListCtrl : public CListCtrl
(2) which has a CustHeaderCtrl m_hdrCustom, where CustHeaderCtrl : public CHeaderCtrl
(3) CRszListCtrl has init() called from CDialog::OnInitDialog.
(4) This init() calls void CustHeaderCtrl::init(CListCtrl * const pList) with Argument this (i.e. self) to init its m_hdrCustom
(5) The code is
void CustHeaderCtrl::init(CListCtrl * const pList)<br />
{<br />
m_pParentList = pList;<br />
CHeaderCtrl * pHeader = m_pParentList->GetHeaderCtrl();<br />
ASSERT( SubclassWindow(pHeader->GetSafeHwnd()) );<br />
}<br />
(6) To catch clicks on the header items I made handlers for WM_NOTIFY messages resent to the header by it's parent list which where routed via WM_NOTIFY_REFLECT macro or alternatively via OnChildNotify.
:(Both work fine but only in debug code!
Who can give a solution? Thank you!
regards Werner
|
|
|
|
|
WernerP wrote: Both work fine but only in debug code!
Check what you have put in ASSERT macros, do not forget these are not compiled in Release mode.
~RaGE();
|
|
|
|
|
Outrageous laughter (Ok, we think we can fix it).+
Thanks.
Bye, Werner
|
|
|
|
|
I have made a regular dll in MFC. Here I have invoked an exported function in which I call a dialog using DoModal method. Now I added a static control on that dialog. Now, whenever I call that exported function in dll using an exe application i'm able to view that dialog, but the problem i'm facing is that i'm not able to get nor set data to the various controls(like static or edit) used in dialog. Like the MFC functions GetDlgItem, SetDlgItemText, SetWindowText, etc doesn't work.
Here is the piece of code
__declspec(dllexport) MyFun()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CMyDialog dlg;
dlg.DoModal();
}
//Constructor for CMyDialog
CDlgTest::CDlgTest(CWnd* pParent /*=NULL*/)
: CDialog(CDlgTest::IDD, pParent)
{
this->SetDlgItemText(IDC_STATIC, "Mayank"); //Not working
}
|
|
|
|
|
You can't use SetDlgItemText in the constructor because the window (IDC_STATIC) has not yet been created.
You need to override the OnInitDialog (WM_INITDIALOG) and put your SetDlgItemText in that function, after the call to CDialog::OnInitDialog();
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Is there some way how to reuse explorer's list control used for browsing the disk/local computer ?
I'd like to have this control integrated in my application with all default features (view modes like thumbnails/icons/...., default shell context menu, etc.
Thank you.
rrrado
|
|
|
|
|
I think the WebBrowser should do it too. Insert the WebBrowser control in the project, and there you go. Then you must start with a real local address like "c:\\" etc. to start it with.
this is this.
|
|
|
|