|
i want to define my own add method that adds one object to some array every time it is called
does any one know how to do this please?
thanx
|
|
|
|
|
Just do it.
<br />
bool CMyClass::AddObject()<br />
{<br />
MyArray[x] = new Object();<br />
<br />
return I_read_book ? false : false;<br />
}<br />
|
|
|
|
|
Hi there,
I have a dialog wizard which I would like to perform its data integrity checks and its eventual task of inserting tonnes of data into various tables.
However, I need all the validations and eventual data insertions to be wrapped in a dll so other applications could use it as well.
How do I load this DLL into my exe wizard in Visual C++ and start using its member functions? what are the options and what is the best way of doing it?
thanks
|
|
|
|
|
From a simple DLL standpoint you would use LoadLibrary("DllName") and GetProcAddress(...) to get access to the functions and use them.
I would however consider writing your data access component as COM. More portable and easier to use.
|
|
|
|
|
I have a 4-byte data, it's content is:
bits 31-24 : pixel_data
bits 21-23 : unused
bit 20 : direction
bits 19-10: y_address
bits 9-0: x_address
So I construct a structure for it as follows:
#pragma pack(1)
typedef struct
{
unsigned int pixel_data : 8;
unsigned int unused : 3; /* must always be zero */
unsigned int direction : 1;
unsigned int pixel_x_address : 10; /* column */
unsigned int pixel_y_address : 10; /* row */
} FIFO_DATA_R_T;
it turns out the the pixel_data is at address bits 31-24, but unused is at bits 16-18.
How should I construct the struct?
many many thanx!
|
|
|
|
|
Hi Lucy. MS compiler has the following specific feature: bit fields are laid out from the least significant bit to the most significant bit. So your struct should be like:
#pragma pack(1)
typedef struct
{
unsigned int pixel_y_address : 10;
unsigned int pixel_x_address : 10;
unsigned int direction : 1;
unsigned int unused : 3;
unsigned int pixel_data : 8;
}FIFO_DATA_R_T; This ordering is a compiler specific thing (Kernighan&Ritchie leaves it undefined, if my memory doesn't fail me).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
got it! Thank you so much!
|
|
|
|
|
c:\program files\microsoft visual studio\vc98\include\iostream.h(50) : error C2144: syntax error : missing ';' before type 'long'
c:\program files\microsoft visual studio\vc98\include\iostream.h(50) : error C2501: 'initialValue' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\iostream.h(50) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
i don't know y it tells me that there is some error with iostream.h class\
can any one tell me how to fix this please!
|
|
|
|
|
Most probably the problem has not to do with iostream.h file, but with the file #include d before it! Try swapping #include s to see what happens.
PS: IMHO it's advisable to have #include<iostream> instead of #include<iostream.h> : iostream (without the .h ) is the latest version of the iostream library according to the C++ standard.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
i tried but it is still not working
every time i click the error it takes me to the iostream class file
any ideas?
thanks
|
|
|
|
|
any ideas?
Yes, post the code
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
i got it fixed thanks a lot
JOAQUIN
you are the one man
|
|
|
|
|
I have a need to add controls to the Print Setup dialog.
I did this via what I thought was the standard means:
- Copied the Print Setup dialog (PRINTDLGORD) to my RC file
- Created a Class based on this new dialog
- Used this new class (CMyPrintDialog) in place of CPrintDialog
- Added controls to the new dialog
- Used the following code:
CMyPrintDialog PrintSetup( TRUE,
PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NONETWORKBUTTON |
PD_HIDEPRINTTOFILE | PD_NOSELECTION | PD_ENABLESETUPTEMPLATE );
PrintSetup.m_pd.hInstance = AfxGetInstanceHandle();
PrintSetup.m_pd.lpSetupTemplateName = MAKEINTRESOURCE( IDD_MY_PRINT_SETUP );
PrintSetup.DoModal();
All seems to work fine except entering text into a Edit Box on the new dialog appears to make the dialog repaint on each character. This is seem as:
- The Protrait/Landscape icon repaints each time a char is typed
- The cursor on the dialog repositions at the begining of the edit box on each char
- Takes a long time for each character and the hourglass appears.
I suspect I have left out a step.
Any suggestions?
AW
|
|
|
|
|
Two questions:
What ID did you use for the edit box; make sure you're not re-using the ID of a control used by the system.
Do you have an EN_UPDATE or EN_CHANGE handler for the control? If so, what actions are you performing in it?
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Hey,
I would like to get started learning about DLLs. I currently only work in MFC and C++ using VC++ 6. Does anyone know of any good tutorials for using DLLs with MFC apps.
.NET or not .NET? MFC is the question......
|
|
|
|
|
Have a look at the MSDN samples DLLHUSK and DLLTRACE. They are fairly good starting points.
My jokes page
|
|
|
|
|
I wonder how it works. Let's say that I have a header file named MyHeader.h
then I want to use the #ifndef stuff... but how?
Like this(?):
#ifndef MYHEADER_H
...
#endif
if yes:
how does the compiler know that MYHEADER_H is my header... hmm... hope you understand..
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
#ifndef MYHEADER_H
#define MYHEADER_H
#endif This prevents a header's contents from being #included more than once.
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
BUT OF COURSE!!
Thanks buddy(ies)!!!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
I want to scale a DIB into a window DC, and to do that I am using StretchDIBits - everything works fine. Because StretchDBits directly in the window DC is a very slow operation , I am trying to speed up the operation by stretching first into a mem DC and then draw the bitmap into the window DC using BitBlt. My problem is that StretchDIBits into the mem DC seems to have no result - nothing appears into the window DC. If I stretch directly everything works fine.
//
HBITMAP hBmp = ::CreateBitmap( /* ... */);
BITMAPINFO bmpInfo
// build bmp info
//original code
::StrectchDibits( hDC, /* ... */); //everything is OK
//updated code
HDC hMemDC = ::CreateCompatibleDC( hDC);
::StretchDBIits( hMemDc, /* ... */);
::BitBlt( hDC, /* ... */, hMemDC, /* ... /-*/); //!?
any help will be welcome ! Thanks .
|
|
|
|
|
solon wrote:
//updated code
HDC hMemDC = ::CreateCompatibleDC( hDC);
After you create the MemDC, you will have a monchromatic bitmap with 1 pixel selected into that memdc. What you need to do now is to create a bitmap that has the proper height, width and color depth to match the Window DC that you want to paint to.
In order to do this you should use some code similar to this:
<br />
RECT rClient;<br />
::GetClientRect(hWnd, &rClient);<br />
HBITMAP hBmp = ::CreateCompatibleBitmap(hDC, rClient.right, rClient.bottom);<br />
<br />
(HBITMAP)::SelectObject(hMemDC, hBmp);<br />
Now you can continue with the code that you have previously written.
solon wrote:
::StretchDBIits( hMemDc, /* ... */);
::BitBlt( hDC, /* ... */, hMemDC, /* ... /-*/); //!?
Finally in order to cleanup, you must do things in this order.
<br />
::DeleteDC(hMemDC);<br />
::DeleteObject(hBmp);<br />
|
|
|
|
|
If I'm adding a static text control to my dialog box, how do I make the text come on more than one line? It seems to just write the text in one long line all the way across the dialog box. I realize that I could just use two static text controls and align them above and below one another, but I don't want to do this because then it gets treated as two seperate texts when doing the Tab Order.
|
|
|
|
|
Change the style to multiline and resize the static control.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi.
I was wondering if there is an easy way to delete an entire directory and EVERYTHING under it. The functions that are available now seems to need the directory to be empty first.
THanks.
|
|
|
|
|
I think this is going to work!!
Fill the SHFILEOPSTRUCT struct like this I think (not tested):
SHFILEOPSTRUCT shf;
memset(&shf,0,sizeof(shf)); // Reset the structure before using it
shf.hwnd = hWnd; // The windowe that will show status (e.g a progress bar that shows how much is left of the file operation)
shf.wFunk = FO_DELETE;
shf.pFrom = "C:\\WINDOWS"; // Delete this structure
shf.fFlags = FOF_SIMPLEPROGRESS; // Display a progress bar
// Finaly:
SHFileOperation(shf);
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|