|
Um... have you tried stepping into OnButtonPressed() ? Where does it hang?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Please be patient with me, I'm a student!
I have tried stepping into it, but...
I decided to step through the Button and List Control box (In the Main Dialog)that works properly so that I could see how that one worked. But while stepping through it pop-up boxes appear requesting that I find the source for certain .C files. I searched my computer for them but couldn't find them. I do have MSDN VC++ libraries installed. If I cancel out of these boxes the debugger starts going through Assembly code.
Why does this happen while debugging, when that part of the application works properly when the application is executed?
So I can't debug the OnButtonPressed() because the same Find Source pop-up boxes appear.
|
|
|
|
|
After a quick lesson in debugging..
I have found that it is hanging on this line,
//Populate the Grids
ListView_SetExtendedListViewStyle(m_SMSMyListControl,LVS_EX_GRIDLINES);
|
|
|
|
|
Perhaps it's dying because you haven't yet inserted the columns? Try setting the LVS_EX_GRIDLINES style after you define the control's columns. Hope this helps!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi there,
I am using the ADO calls to connect to my database and have the following call:
_variant_t varFieldValue;
varFieldValue = m_pRecord->Fields->GetItem((long)nCol)->GetValue();
Now, at some point , I like to convert this varFieldValue to a string, preferably a STL string.
Any tips on how to do this?
thanks
|
|
|
|
|
this should get your variant value into a CString.
CString strTest;
strTest = varFieldValue.bstrVal;
|
|
|
|
|
Nope, that won't work if the variant isn't already a VT_BSTR.
However using static_cast <_bstr_t> (v) will convert the variant to a BSTR and return the string.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I'm already familiar with the basics of c++ like pointers, multiple inheritance,... but nothing with "windows".
For the last couple of years, I've been programming in java, and I dare to say this, I know it all (almost ).
My question is this: Are there any migration tutorials for java -> c++/vc++?
Bluute tette!
|
|
|
|
|
i know where you are coming from, i developed in java for a year er so.. switched to VC++ a few months ago.. i think once im done with my current project ill be switching to C#.. maybe you should take a look at it as well..
-dz
|
|
|
|
|
The only ide that I've got is visual studio 6, so I'll probably stick to it.
Actually, I don't know c# at all, so I'm gonna take a look
Bluute tette!
|
|
|
|
|
Windows is an event driven environment, virtually identical to AWT. MFC is a thin object oriented layer over the Win32 API. The development tools (esp. the resource editor) are nicer than tools used to develop Java.
You might find C# to be a better migration path. It's more in line with Java - similar syntax, concepts and a reasonably extensive (imho) class library.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I have a socket client which will send data ( raw bytes followed by HTTP request) to the IIS server.
EX: the packet would be something like this,
"Binarydata(96 bytes)GET /myserver/myserver.asp?val1=v1&val2=v2 HTTP1.0 /n/n"
The above data represents some Binarydata of 96 bytes followed immediately by HTTP request reaching the
server page myserver.asp through the IIS Server.
If this data is sent directly( without filter) from the socket client to the Server , the IIS server would not interpret the
request, as the actual "GET" request is preceeded by some Binarydata.
I need help in the approach for developing an ISAPI Filter which satisfies the following criteria,
1. The ISAPI dll would run in between the IIS server and the Socket Client application.
2. It would capture all the bytes that is sent from the Socket Client application to the IIS server, strip out the 96 bytes & process it.
I would also like to know if ISAPI is the right approach.
Thanks for reading . Eagerly Expecting replies
regards
raja
|
|
|
|
|
I'm trying to update the filename extension on the Filesave dialog box from the OFNOTIFY whenever I select a filetype in the combobox.
Thanks
|
|
|
|
|
Hi all,
What's the best collection class for CPoint objects?
Index is not important, only i need is tail and head.
Thank you.
|
|
|
|
|
hi!
2 questions about UNICODE:
1. I have to convert char* based strings into TCHAR* (that is UNICODE) ones. THe Macro _T() only works for immediate strings such as "Hello" but not with variables, and a cast in (TCHAR *) or even (unsigned short*) mostly destructs what is written in the string (i.e. i got garbage in my string instead of hello, which i think is quite normal.). Any suggestion ?
2. Does it exist an equivalent to atoi() for UNICODE strings ?
Thanxx
RaGe
Unfortunately, brute-force solutions tend to be slow
even when performed by modern-day microcomputers,
which are capable of several MIPS except when I'm late
for an appointment and want to finish a compile and
run just one more test before I leave, in which case
the crystal in my computer is apparently designed to
automatically revert to 1 Hz.
-- Michael Abrash
|
|
|
|
|
Well, first TCHAR is not a UNICODE. It will be converted to unicode only if you compile your program as unicode.
If you want to convert ANSI to UNICODE and vise versa strings, I'd suggest to use bstr_t class. It excepts both and can return both of types.
As for atoi for unicode, so it is wtoi or _ttoi for TCHAR (determined in time of compilation)
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
1- ATL (and I think also MFC) comes with a bunch of macros:
An excerpt from MSDN library:
ATL 3.0 String Conversion Macros
The original text conversion macros are still available and are listed in the table below:
ATL 3.0 String Conversion Macros
A2BSTR OLE2A T2A W2A
A2COLE OLE2BSTR T2BSTR W2BSTR
A2CT OLE2CA T2CA W2CA
A2CW OLE2CT T2COLE W2COLE
A2OLE OLE2CW T2CW W2CT
A2T OLE2T T2OLE W2OLE
A2W OLE2W T2W W2T
All those macros map Ascii (A), OLE (OLE), and Wide (W) strings to another type.
Ex.
USES_CONVERSION;
_TCHAR *tsz = _T("hello world");
WCHAR *wsz = T2W(tsz);
LPOLESTR *olesz = W2OLE(wsz);
char *sz = OLE2A(olesz);
BSTR bsz = A2BSTR(sz);
Don't forget the USES_CONVERSION macro. You don't need to free memory, except for the X2BSTR ones, which require a call to SysFreeString function.
2-
_wtoi (and _ttoi for the _TCHAR ones).
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
strange to see how html does not look like it should be
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
I have been looking for how to print multiple pages, and i see references to printing without using document/view, and using the StartPage() command for each page..
i have looked through all of the CView documentation and nowhere in there do they use StartPage() or StartDoc()...
can someone tell me where i would use this StartPage() command if i was using the Document/View archetecture, or if there is a different way to print multiple pages when using it?
thanks in advance!
-dz
|
|
|
|
|
StartPage() is a call that can be made to a printer DC object when printing. I have an example here:
void COpenGLCtrl::OnPrint()
{
CPrintDialog dlg(FALSE) ;
if (dlg.DoModal() == IDOK)
{
CreateBitmap() ;
CDC dc ;
dc.Attach(dlg.GetPrinterDC()) ;
DOCINFO di ;
CString new_text ;
CPrintInfo printInfo ;
CString title ;
GetWindowText(title) ;
new_text.Format("Printing Graph\"%s\"", title) ;
di.cbSize = sizeof(DOCINFO) ;
di.lpszDocName = new_text ;
di.fwType = 0 ;
di.lpszDatatype = NULL ;
di.lpszOutput = NULL ;
dc.StartDoc(&di) ;
dc.StartPage() ;
printInfo.m_rectDraw.left = 0 ;
printInfo.m_rectDraw.top = 0 ;
printInfo.m_rectDraw.right = dc.GetDeviceCaps(HORZRES) ;
printInfo.m_rectDraw.bottom = dc.GetDeviceCaps(VERTRES) ;
HeaderFooter(&dc, &printInfo) ;
int cxInch = dc.GetDeviceCaps(LOGPIXELSX) ;
int cyInch = dc.GetDeviceCaps(LOGPIXELSY) ;
CRect rectTo ;
rectTo.left = printInfo.m_rectDraw.left ;
rectTo.top = printInfo.m_rectDraw.top ;
rectTo.right = printInfo.m_rectDraw.right ;
rectTo.bottom = (int)( ((double)m_sizes.cy * printInfo.m_rectDraw.Width() * cyInch) / ((double)m_sizes.cx * cxInch)) ;
if (rectTo.bottom > printInfo.m_rectDraw.bottom)
{
rectTo.top = printInfo.m_rectDraw.top ;
rectTo.bottom = printInfo.m_rectDraw.bottom ;
int width = (int)( ((double)m_sizes.cx * printInfo.m_rectDraw.Height() * cxInch) / ((double)m_sizes.cy * cyInch)) ;
rectTo.left = printInfo.m_rectDraw.left + (printInfo.m_rectDraw.Width() - width) / 2 ;
rectTo.right = rectTo.left + width ;
}
::StretchDIBits(dc.m_hDC,
rectTo.left, rectTo.top, rectTo.Width(), rectTo.Height(),
0, 0, m_sizes.cx, m_sizes.cy,
m_pPixelData, &m_bmi, DIB_RGB_COLORS, SRCCOPY );
dc.EndPage() ;
dc.EndDoc() ;
VERIFY(dc.DeleteDC()) ;
DestroyBitmap() ;
}
}
The above is an example for an OpenGL Ctrl I have which prints the image to a printer. It also in some ways emulates the MFC code as it uses the CPrintInfo structure to gather information about the printable area. It covers all the basics of what you need I think.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Different to my previous answer.
The MFC doc/view handles the printing using the following functions:
OnPreparePrinting()
OnBeginPrinting()
OnPrint() // by default this calls your views OnDraw()
OnEndPrinting()
In your OnPreparePrinting you need to setup the CPrintInfo structure with the number of pages you wish to print:
pInfo->SetMaxPage(5) ;
The MFC code will then call your OnPrint() function once per page. It will have done the calls to StartDoc() and StartPage/EndPage() for you. You will need to look in the pInfo->m_nPage member to see which page is being printed. From this info you can determine which data to print.
OnBeginPrinting and OnEndPrinting are only used if you need to configure the output DC etc for a special print operation.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Look at the MSDN article "CView::OnFilePrint and Other Command Handlers". It has a flowchart of the CView printing architecture.
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
I need to know the inf file that is equivalent to ntprint.inf in NT and Win2000. I am in need of diff. printer info and their driver files.
Can any one tell me what is pconfigfile while installing printer driver programmatically(AddPrinterDriver). Can i use any default file for this parameter, if so what is it for Win98,2000,me,nt ?
Please advise ....
Thanks in advance.
Somu.l
|
|
|
|
|
Hello world! I am stuck. Any help is highly appreciated.
Here is the situation:
I have 3 dialog box in a tab setting. base dialog has a
tab control, one edit control, and 4 buttons (Ok,Cancel,
Show, Populate).
PageOne dialog has a text control, and PageTwo has one text
control. All I want is: if I press Show button which is on
the basePage dialog, I want to see contents of all text controls
(basePage, PageOne, PageTwo).
If I press Populate button, I want to populate all text controls
of three dialogs (basePage, PageOne, PageTwo).
If you need more clarification, please send me a mail.
Thank you in advance.
|
|
|
|
|
you should be able to use pDlg->GetDlgItem to get to those controls.
-c
Conscience is what hurts when everything else feels good.
Smaller Animals Software, Inc.
|
|
|
|