|
For starters, set a breakpoint in the handler for the Start button. Begin debugging at that point. You might also consider judiciously-placed ASSERT() statements. They alert you when the state of your program is not what you think/expect it to be.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I think the problem is that when i start programm for second time it has some problems with reading from the source (XML)file(.xml)..
Im opening the file with GUI by using CFileDialog and also f.open in function and closing just with f.close ..Could that be the problem? If yes how do i close it with GUI?
And also,Do i need to call OnInitDialog function after the programm ends for the first time?
Thank you very much,
Alex
|
|
|
|
|
rfixxxer wrote:
Im opening the file with GUI...
How you open a file and whether the program has a GUI are mutually exclusive things.
rfixxxer wrote:
...f.open in function and closing just with f.close ..Could that be the problem?
I don't see how, as long as the file opened and closed with no errors.
rfixxxer wrote:
If yes how do i close it with GUI?
Again, the opening and closing of a file is independent of whether it has a GUI or not. The key here is consistency. If you opened the file as a stream, it must be closed as a stream. If you opened the file as a handle, it must be closed as a handle. No mixing!
rfixxxer wrote:
Do i need to call OnInitDialog...
Only as a child class calling its base class implementation. Otherwise, this function is called by the framework in response to a WM_INITDIALOG message.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Problem solved!!!
It was a small thing actually..
Thank you very much for the help,i'm thankfull
Alex
|
|
|
|
|
In a Visual C++ application I am doing, I must populate an Excel spreadsheet with some parsed data. I would like to place some images in a header prior to the parsed data. I use FPUTS to output the parsed data to the spreadsheet but is there a way to put images to the spreadsheet from my C++ program?
|
|
|
|
|
why aren't you using Excel objects? some restrictions on design?
Jaime
|
|
|
|
|
No restrictions, I don't use excel that much and am not too familiar with what it can do. I just need to put tons of parsed data from a binary file into a spreadsheet. I just wanted to put some special symbols in the heading. I tried to create a template with the symbols and then append the parsed data, but it seems that excel won't allow this. I then was wondering if the symbols which are in gif formats could be written to the spreadsheet from my C++ program.
Thanks!
|
|
|
|
|
could anyone please tell me where can i find source code for "testing random numbers".
i'd appreciate it sooooo much....
thanx
|
|
|
|
|
A single-tailed chi-square test should suffice. You should be able to find some code that does this on Google...
"Oh, I'm sick of doing Japanese stuff! In jail we had to be in this dumb kabuki play about the 47 Ronin, and I wanted to be Oshi, but they made me Ori!"
|
|
|
|
|
Suppose that there is a window of another process and that window has a CListCtrl on it , i only have the CWnd pointer of the main window that hosts the CListCtrl, i need to add/remove entries in that CListCtrl, ...
My approach is that
First i need to first get access to the CListCtrl window by getting its handle using
BOOL EnumChildWindows( HWND hWndParent,
WNDENUMPROC lpEnumFunc,
LPARAM lParam
);
and once i get this handle i would either try to get CWnd* from it or try sending LVM_XXX messages using CListCtrl handle...
I am unsure about if all this would work ...
any of you guys , if have any views please share
Ahmed
|
|
|
|
|
If you have the CWnd pointer of the target window (main window, for now), then continuing from there is very, very easy.
First, use GetTopWindow to get the first child window of the main window. Save this into a seperate pointer. Using the returned pointer, first call ::GetClassName to get the class name of the window. Specify CWnd::m_hWnd as the HWND parameter. If the returned name matches "SysListView32", then this CWnd is the list view control.
If the name doesn't match, use the child window pointer and call CWnd::GetWindow( GWL_HWNDNEXT ) to retrieve the next window in the chain. When the pointer is returned, use CWnd::IsChild with the main window pointer to determine if this window is still a child of the target window. If it is, compare the ::GetClassName again with the list view control classname.
After you find the CWnd that
a) Is a child of the main window
b) Matches the list view control classname,
then use DYNAMIC_DOWNCAST like this:
CListCtrl* pListCtrl = DYNAMIC_DOWNCAST( CListCtrl, pMainWindow ); This will give you a pointer to the CListCtrl class of the list control. If the returned value is NULL , the cast failed. It shouldn't be NULL , because the SysListView32 is encapsulated by the CListCtrl . Remember that your project must be compiled with the Run-Time Type Checking option set to Yes. Otherwise the cast will also fail.
Now use the CListCtrl pointer to manipulate the list view control.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi,
I have pasted a peice of code that I use to create the combo box dynamically, but found that it draws a edit box, not a combo box.
CComboBox m_schemaCombo;
m_schemaCombo.CreateEx( WS_EX_CLIENTEDGE, _T("COMBOBOX"), NULL,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | ES_NUMBER,
CRect(row3,
frameTop + 3 * topBottomOffset + buttonHeight3,
editBoxWidth,
frameTop + 3 * topBottomOffset + buttonHeight2 + buttonHeight2),
this, IDC_SCHEMA_COMBO, 0 );
m_schemaCombo.SetFont( GetFont() );
Very sceptical about the 2nd argument of CreateEx. Can anybody help me out?
Also, please let me know the way to create a checkbox also.
Thanks,
Prashant
|
|
|
|
|
Try using the CComboboxEx class instead of the Combobox class. I'm not very sure but I hope this is useful
Dipeka.A.J
|
|
|
|
|
No CComboBoxEx did'nt help....
-Prashant
|
|
|
|
|
I think the third parameter of createex cannot be NULL. Try using this->m_hWnd(pointer to parent dialog). Hope this helps
Dipeka.A.J
|
|
|
|
|
The answer is quite simple.
What you are doing here is calling CWnd::CreateEx , that allows you to create child windows. However, there is a function call CComboBox::Create that will create a combo box control and attach it to the CComboBox object.
The calling convention for Create is a bit different, as you only need to supply the standard flags, rectangle, pointer to parent CWnd and the ID. This call doesn't allow you to specify extended window flags. But you can use GetExStyle , a bit mask and SetWindowLong to set the client edge extended style.
Another reason why it creates an edit box might be because of the ES_NUMBER flag. This flag is meant for edit controls, not comboboxes. All combobox flags start with CBS_ prefix. Try removing it and see what happens.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
How about:
CComboBox m_schemaCombo;
m_schemaCombo.Create(WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWN,
CRect(row3,
frameTop + 3 * topBottomOffset + buttonHeight3,
editBoxWidth,
frameTop + 3 * topBottomOffset + buttonHeight2 + buttonHeight2),
this, IDC_SCHEMA_COMBO);
m_schemaCombo.SetFont(GetFont());
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks David....It worked.
|
|
|
|
|
I am on XP and I have created an overlapped mode pipe. I call ConnectNamedPipe and set the event on wait in WaitForSingleObject. Problem comes when the WaitForSingleObject times out in release mode compile. Any other call to the pipe handle on which no client connects and connection time out throws some exception in release mode . It all works fine in debug mode.
<br />
OVERLAPPED op;<br />
op.hEvent = CreateEvent(....<br />
HANDLE hPipe = ConnectNamedPipe(....<br />
<br />
switch(WaitForSingleObject(op.hEvent, 5000)<br />
{<br />
case WAIT_OBJECT_0:<br />
...
CloseHandle(hPipe);
<br />
case WAIT_TIMOUT:<br />
...
CloseHandle(hPipe);
}<br />
PS: every thing works fine in Debug mode...Exceptions come in on release mode
Atif
|
|
|
|
|
Hi there
Im sorry because this is not realy a VC++ Question and its maybe the wrong forum...but here i am
Does anyone knows some ressources/manuals (e.g. URL's, PDF's, ...) of how a normal bitmap is build/written? -> If possible - the newbie way
I need to write code which "writes" a bitmap to a file - but i cant use librarys or the win32/mfc/... methods for doing this
Thanks for reading
--------------------
select *
from users
where
iq > 60;
0 rows returned.
|
|
|
|
|
Hi,
a bmp consists of a header and a colordefinition of each pixel. (so you get a header and a matrix of colors)
you can write the bmp bytewise with fwrite I think. just make sure the header is correct AND write the colors BACKWARDS (BGR instead of RGB). (one color is three bytes, no?)
a little help: open a bmp with a hex-editor. you'll see what I mean.
Hope this helps (a little )
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
A Beginners Guide to Bitmaps[^]
and
Bitmaps and Palette Manipulation[^]
are just a couple of randomly picked examples when you use Google and search for Bitmaps!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Oh the google way
Thanks both of you
|
|
|
|
|
I tried to make a project with one Document and 2 views. But I had a problem - i can't switch between them. How to do it?
In InitInstance i did this:
CSingleDocTemplate* pDocTemplate;
CSingleDocTemplate* pDocTemplate1;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CSDIMultiViewDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CSDIMultiViewView));
AddDocTemplate(pDocTemplate);
pDocTemplate1 = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CSDIMultiViewDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CSDIMultiViewListView));
AddDocTemplate(pDocTemplate1);
|
|
|
|
|