|
I am sorry people but I found the answer to my question. It took me a week to find what was right in front of me. Sometimes when you look too hard for an answer which is screaming in front of you you don't see it. I would have deleted this message but I couldn't. Don't know why.
none
|
|
|
|
|
I want to create a function that will take an array pointers to any data type and resize it at runtime. But I know I can't use xalloc since I'm initially allocating the memory with new. But I also can't use new in the function when I don't know what data type I'm using, or can I? Must I overload the function with everything I use it for and rewrite the operator= for every new class I use it for? There must be an easier way to do it.
|
|
|
|
|
std::vector
std::vector<MyPtr*> vPtr;
for(int i=0; i<nPointers;i++)
{
vPtr.push_back(new MyPtr);
}
MyData = *vPtr[iIndex];
vPtr.clear();
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
brandon1879 wrote:
I want to create a function that will take an array pointers to any data type
That's what templates are for.
template <typename ELEMENT_TYPE>
bool ResizeArray ( ELEMENT_TYPE** ppElts, size_t nCurrSize, size_t nNewSize )
{
}
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Ok, I am developing a quasi-realtime data display with some dials and sliders on it. The controls are in their own modeless dialog so users can show or hide them as they please. I am aquiring the data from a seperate datasource from within a seperate thread, and will pass the data structure to the UI via message pump. I also wrote a "window manager" class to handle which controls are shown and which ones aren't. I plan on sending a message to the "window manager" with the data structure, and then have the window manager send messages to the individual controls.
So my question is:
Do I:
A. Use SendMessage() from the DAQ thread and wait for the updates to return before acquiring the next sample, and use SendMessage() from the window manager to all the controls.
B. Use SendMessage() from DAQ and PostMessage() to the controls from the window manager, letting the control windows handle their own message que.
C. Use PostMessage() from the DAQ to the manager, and SendMessage() to the controls.
D. Use PostMessage() all around, passing the structures created on the heap and deleting them within the message handlers.
E. Some other method
Aside:
The data aquisition will more than likely take longer than the window updates, so I probably won't be flooding the message que. I plan on running between 10 Hz - 30 Hz.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I think you have to use PostMessage() all around. Because SendMessage() returns only after the message procceed completely while PostMessage() only puts message into the message queue and returns.
Here data aquisition will take longer time then message processing. SendMessage() also take some time to process the message. So it probably make the whole process slower.
C.R.Naik
|
|
|
|
|
Also for process-safety, prefer using PostMessage. Windows guarantees that PostMessage can always be safely called from within any thread (even inside kernel code or with some gdi-locks unavailable) which is not true for SendMessage, because it is per-se unknown what the called dialog-procedure might do.
|
|
|
|
|
Pater wrote:
Also for process-safety, prefer using PostMessage.
I agree. I will implement it this way. Thanks!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Chintan wrote:
I think you have to use PostMessage() all around.
That's what I was leaning towards but I didn't want to lead any answers. Thanks!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hi.
Im creating a print preview and printing classes which use, among others, CRichEdit class. Ive managed to get it working very well (not using Doc/View Arch.) EXCEPT for one detail: when i print a RTF text with double spacing between the lines, it works fine both on preview and on printing. When i use single spacing (default), it puts half the space between lines in printing than in preview!! I dont know if its the printing or the print preview that is working wrong on this, or is it a weird bug in CRichEdit...
Thanks in advance
Miguel Lopes
|
|
|
|
|
E.g., Yahoo.com
When I move the cursor on the Yahoo.com, how can I get the URL of this link from outside. I will not host the internet browser. In other words, is there a function that I can hook to retrieve the URL? Thanks.
|
|
|
|
|
|
Thanks. This is very helpful.
|
|
|
|
|
I am working on some functionality using AnimateWindow() and I was curious to know if anyone had a good example of a WM_PRINTCLIENT implementation.
Any help would be appreciated.
Thanks,
David Ramsey
|
|
|
|
|
Hiya where is the Project->Settings in Visual Studio.NET, that is in Microsoft Visual 6.0. Need to add some .lib files to my project..
Thanks,
grahamoj.
|
|
|
|
|
Go to your project in the solution explorer, right click and choose properties. When the dialog comes up choose Linker and then input. Additional Dependencies is the first item on the page.
Hope this helps.
|
|
|
|
|
When you do this, make sure you right click on your PROJECT, and not on the solution! The properties for the Solution is pretty much worthless.
You can pick your friends, and you can pick your nose, but you can't pick your friend's nose.
|
|
|
|
|
You might be trying to add lib file before starting the project. First select new project and do its settings .
-------------
Fist of all, select
File =>Projects and choose the type of project u want to make ie. MFC exe .
Then complete the steps for project settings
After finishing that then see at menu options on top , click on
Projects==>Setttings==>Click on Link tab and add the lib files in Obje:-Dct/Library module
|
|
|
|
|
You might be trying to add lib file before starting the project. First select new project and do its settings .
-------------
Fist of all, select
File =>Projects and choose the type of project u want to make ie. MFC exe .
Then complete the steps for project settings
After finishing that then see at menu options on top , click on
Projects==>Setttings==>Click on Link tab and add the lib files in Object/Library module
|
|
|
|
|
I have a CFormView. In the lower right corner,
the user can stretch or compress the application.
How can I make the CFormView stay a fixed size
or in other words, how can I get rid of those
slanted bars in the lower right corner so that
a user can not adjust the size?
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
The ability to size an application is owned by the frame; your CFrameWnd class which is probably in your mainfrm.cpp file. If you override the PreCreateWindow function to look something like the following, I think you'll get what you're looking for:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style = WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_MINIMIZEBOX;
return CFrameWnd::PreCreateWindow(cs);
}
Ron Ward
|
|
|
|
|
The resizing is due to the frame window, the view is a child of the framewindow.
Do this :-
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style &= ~WS_THICKFRAME;
return TRUE;
}
Regards
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Another solution is to handle ON_WM_GETMINMAXINFO().
-----
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
{
// TODO: Add your message handler code here and/or call default
CFrameWnd::OnGetMinMaxInfo(lpMMI);
lpMMI->ptMinTrackSize.x = ...;
lpMMI->ptMinTrackSize.y = ...;
lpMMI->ptMaxTrackSize.x = ...;
lpMMI->ptMaxTrackSize.y = ...;
}
-----
Kuphryn
|
|
|
|
|
Does anyone know how to derive a CBitmap pointer to a CImageList entry, so that an individual list entry(image) can be access and manipulated ?
Cheers.
|
|
|
|
|
The function CImageList::GetImageInfo(int nImage , IMAGEINFO * pImageInfo) returns the image information of image at entry number nImage into pImageInfo .
The IMAGEINFO contains a member HBITMAP hbmImage , which is the handle to the image list's HBITMAP . The image list stores all the image in a single image strip, so there is another member RECT rcImage the contains the rect of the image inside the bigger bitmap. You may attach the hbmImage in a CBitmap then manipulate it within the given rect.
I have tried it and failed, but could not identify the problem. If it failed with you, then there will be no other way (as far as I know) except to create a new CBitmap then call CImageList::Replace() passing to it the image entry and the CBitmap pointer to set a new bitmap for the entry. If you need to retreive the image at an entry you may use CImageList::DrawEx() to draw the image at certain entry on a give DC
|
|
|
|