|
im new to c++, currently doing project with vc++ .net is there any tutorials, for beginners on guis' and event driven programming??????
thanks!!!
|
|
|
|
|
Hi,
Why are you guys search outsides? Try to learn from MSDN itself. In MSDN lot of tutorials, articles and other staffs are there.
Regards,
Selvam
|
|
|
|
|
Hi, I have some debugging code, one of these functions writes a message to a file, but i also wan't to know from where the message was sent, so my prototype looks like this:
Debug(const unsigned int Line,const char* File,const char* Function,const char* Message,...);
The problem with this is that it'll need a lot of parameters, Line will always be __LINE__, File will always be __FILE__ and Function will always be __FUNCTION__, so i thought i could just define a macro(#define) which take Message and ..., but the problem is that ... can't be taken as a parameter for a macro and there is no way to send the "..." to the real debug function. So do anyone got any idea how i can do this. I want to call the function something like this:
Debug("Int with the value of 42: %i, and in hex: %x",42,42);
And then in the file it'll look something like this:
...
Car.cpp[Line: 52] (Called from: StartEngine()):
Int with the value of 42: 42, and in hex: 2A
...
|
|
|
|
|
I know I've seen an article on this subject in the Debug section here on CP, but in short you make a class that has an operator() overload which resolves to a call to your Debug() function. Debug() then takes a va_args parameter instead of ... , and uses vsprintf() or FormatV() if you're using CString .
The end result is something like (this is rough and untested, but should be enough to get you started):
#define DEBUGMSG CLogWrapper(__LINE__,__FILE__,__FUNCTION___)
class CLogWrapper
{
public:
CLogWrapper(unsigned uLine, LPCTSTR szFile, LPCTSTR szFunction) :
m_uLine(uLine), m_szFile(szFile), m_szFunction(szFunction)
{ }
void operator()(LPCTSTR szMessage, ...)
{
va_args va;
va_start(va, szMessage)
Debug(m_uLine, m_szFile, m_szFunction, szMessage, va);
va_end(va);
}
protected:
unsigned m_uLine;
LPCTSTR m_szFile, m_szFunction;
}; Then call it like:
int main()
{
DEBUGMSG("Int value: %d", 42);
}
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
Thanks, will look into that tommorrow if I get some time, but now I'll go to bed(2:50AM here).
|
|
|
|
|
Well, you have asked your question more than 2 years before from today. Hence I believe any solution might be of little use to u now. However, it might be useful for a person just browsing through the discussions(the way I saw your question).
The required info about alterative to ellipses can be found at:
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_vccrt/html/a700dbbd-bfe5-4077-87b6-3a07af74a907.htm
|
|
|
|
|
Hi, I am having a diffcult time understanding how to print/preview multiple pages. I set up the max number of pages in OnPreparePrinting() and go about print/preview in OnPrint(). However, it always print/preview only the page that is shown in my SDI window.
Does anyone know what I need to do to get the other pages to work? Thanks in advance!
|
|
|
|
|
|
Hi,
I'm interessted in building some docking windows that can contain CView derived classes by myself.
The problem is that I have no clue how to do it.
I've been trying, in vain, to customize a CControlBar...
Any clue or hint would be vaulable!
__________________
"There is an empty room full of people who think you are creative"
|
|
|
|
|
|
Hey all,
I've got to create 5 similar dialogs for a new app I'm writing. All 5 dialogs have the same 3 controls on them (a couple of CStatics and a CEdit control) in addition to a few controls that will be unique for each of the 5 dialogs.
Is there any way to accomplish the following?
- Create a base dialog (CBaseDialog), derive it from CDialog, add those 3 common controls to it.
- Use that new CBaseDialog class as the base class for my 5 similar dialogs so that I don't have to copy/paste the 3 controls onto each of the 5 dialogs?
I'm thinking that since the controls are created from the resource file, I might run into a problem with something like that...
Thanks.
-Mike
-Mike Zinni
"Don't take life too seriously, you'll never make it out alive"
- Van Wilder
|
|
|
|
|
Why not just host a modeless dialog box inside your main CBaseDialog?
<br />
CBaseDialog _base ;<br />
CCustomDialog _custom ;<br />
_base.SetChild( &_custom ) ;<br />
<br />
_base.DoModal() ;<br />
...
<br />
BOOL CBaseDialog::OnInitDialog() <br />
{<br />
BOOL bReturn = TRUE ;<br />
CDialog::OnInitDialog();<br />
m_pDialog->Create( this ) ;
<br />
CRect rFrame ; <br />
CWnd * pFrame = GetDlgItem(IDC_STATIC_FRAME) ; <br />
pFrame->GetWindowRect( rFrame ) ;<br />
ScreenToClient( rFrame ) ;<br />
m_pDialog->MoveWindow(rFrame, FALSE) ;<br />
<br />
return bReturn ;<br />
}<br />
There is more to do such as chaining the child's DoDataExchange() in the CBaseDialog::DoDataExchange() and maintaining the dialog position in OnMouseMove() but that is a fairly trivial.
|
|
|
|
|
Yes, it is possible. Just make sure the common controls all have the same IDs.
http://www.codeproject.com/dialog/dialogsubclass.asp[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I have problems about building the projects that include directx libraries, headers or components...
I installed directx 9 sdk but nearly allof the projects on directx give fatal errors..
like "incorrupt file" or linking errors or macros are not defined etc.
what must i do????
exela
|
|
|
|
|
hello to everyone im a studet in tijuana mexico im having problems in school we needed to present a program that will manipulate hardware in my case i did an led display in turboc the problem is that our teacher wants that our program will manage threads or work with threads i dont have any experience with threads any informaton tutorials source code or wahtever will be much apreciated it is urgent for me
Thank you everyone who took the time to read this rookie's problem
|
|
|
|
|
if you talking about old Turbo C , I am very sorry there is no support for multithreading in Dos based application.
but you can simulate that by using GetVert() and SetVert() function,see detail for them in your local turbo C documentation.
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi,
Can anybody help me with the following?
I have a text file with some text. The text on each line is separated by a comma. The length of the text on each line varies. I have to store this information somehow.
I intended to create a 2D array but the size of an array has to be fixed, so that wouldn't accomodate the case where I am reading text from a large file.
It was suggested that I use a vector, but I have no idea how to work with them.
Can somebody help me out with how to create a vector that acts like a 2D array. Also how can I resize the vector? Where can I find an API that shows what methods can be used?
Hope this isn't asking too much.
Thanks very much,
dlarkin77
|
|
|
|
|
Hi Dlarkin!
there Is predefined VECTOR Class in STL under std namespace.
Search for Vector in you local copy of MSDN
or Here is Small tutorial to use that.
#include <vector>
#include <iostream.h>
std::vector<int> i;
void main()
{
i.push_back(20);
i.push_back(30);
i.push_back(40);
std::vector<int>::iterator it;
for(int j=0,it=i.begin();it!=i.end();it++,j++)
cout<<j<" Element in vector is " <<*i<<endl;
}
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
If just need to read the file and process its contents then I suggest having a look at memory mapped files. This will let you treat the file as one big string. Very fast to.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Dear Sir,
Problem Description – Unable to capture audio from USB Audio Device when the format is set to MuLaw.
Scenario – We developed USB Audio Device that produces Audio in MuLaw Format. The USB descriptors are correctly set to indicate that the Audio format. Please see the attached file showing the descriptors.
Description – We want to capture Audio in MuLaw format. Windows DDK documentation states that it supports all “All Type I formats” (MuLaw being one of them). Refer to http://www.microsoft.com/whdc/device/audio/usbaud.mspx (document name - USB_Audio_and_Windows.doc). Also refer to the same information in Windows DDK documentation at mk:@MSITStore:C:\WINDDK\2600\help\stream.chm::/hh/ddkslm/stream/aud-design_8gmr.htm.
When we connect the Audio device Windows recognizes it properly as an Audio device and shows it in the Control Panel. When we check the Audio formats using both GraphEdit (DirectX 9.0) and Adobe Audition, it shows as “None”. As a result we are unable to capture Audio from the device.
Additional Info – When we change the USB Audio Device properties (by changing the descriptors) to PCM8 the device works without any problem.
|
|
|
|
|
Dear Sir,
i am also working on USB(newbie here.....)
i have a doubt?
i want to use windows usb driver,but how do i direct the midi data to this??
i a have directed the midi data to the default windows sw synth,what r the commandz that r reqired to set this to the already existing windows midi usb driver???/
please help me out!!!!!
|
|
|
|
|
Ms VC++ .Net 2003 tells me this just out of nothing for (some) breakpoints, at some build, however it worked totally correct at the last build. Someone recommended me deleting build folder, done that, deleting project.suo, done that, debug and non-incremental RE-build, done, turning all optimalisation options OFF, done.
Then what the hell causes this stupid error or whatever?
|
|
|
|
|
There is a lot of examples of using ActiveX components in MFC applications, but I didn't found any code which shows, how to use ActiveX in no-MFC apps.
I don't know MFC, but I often need to include ActiveX (like Web view) into my projects. Is there a way to do it, or I need to learn MFC?
|
|
|
|
|
Please,
How create a Printer Port Monitor??
I need to create this.
Please help me!!!
raf-sp
|
|
|
|
|