|
this is basically what TRACE does:
void MyTrace(const char* fmt, ...)
{
char buffer[1024];
va_list argptr;
va_start(argptr, fmt);
_vsnprintf(buffer, 1024, fmt, argptr);
va_end(argptr);
OutputDebugString(buffer);
}
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
However, if you were to write your own, I would break the resultant string up into lengths of text no longer than 256 bytes.
Some debuggers interpeting the results from OutputDebugString used to have trouble with strings over 256 bytes in length.
If you split it up into lengths of about 70, it would be easier to read in the output window too!
|
|
|
|
|
So how is the TRACE marco being defined?
#define TRACE ???
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
|
Well, i would like to have a button in my programm, that will open my default mail client programm (Outlook 6, Outlook 2003 or smth. else) and make a message to be send with attachement. So... I tried the way with shellExecute, but i don't know is it possible to insert a file as attachement to the message or not... If it's available - i would appreciate your help...
Thank you very much...
|
|
|
|
|
Hi,
The MFC Document/View Architecture has this facility.
For simple program with sending mail from File menu u can follow this method:
1 . Add a menu item with ID: ID_FILE_SEND_MAIL
2 . Add these to Application document’s message maps:
ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL,OnUpdateFileSendMail)
Compile and Build.
Up On testing the default mail clients will be opened, u can even add an atachement to it.
Regards
jsk
|
|
|
|
|
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello All,
I am working on screen saver, which need to display an Image in different ways i.e. coming from bottom/top , fading in or fading out or more. I would love to make these by my own, But i have no time left to do so and deadline is approaching , So i am going after any ready made solution offcourse with Source Code!.
Please somebody point me in right direction to accomplish above task! thanks
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
Ghasrfakhri wrote:
there is a powerful class ,http://www.codeproject.com/bitmap/cximage.asp[^] it think its that your need
I taken my comment wrong, I can display Picture or Image, I need to show different Image Effects like fading in ,fading out etc! like screensaver shows that isa
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
For example you have 3 columns in your clistctrl
name idnum phone
----------------
ben 123 2335
alic 122 2334
then in your dialog you have
a CEdit were user can enter phone number
lets say 2334 the user hits the enter key
clistctrl will update with 2334 highlighted
thank you very much
|
|
|
|
|
|
Hello everyone!
I would like to ask how can we control (send commands to or read data from) USB ports/devices in Visual C++? Is it possible in Borland Turbo C++?
Thank you very much!
|
|
|
|
|
USB is not like a serial port. You cannot just open it and send data on it. You will need to write a driver which is 'linked' to a specific hardware. When connected, the hardware will send its VID and PID (vendor ID and Product ID) and this will allow the operating system to load the specific driver. The link between the driver and the ID's is made through an inf file that contains the information.
Then, once your driver has been loaded, your application can then 'call' functions from the driver.
Hope this helps
|
|
|
|
|
Why doesn't this work?
I made a dialog based application in MFC. When the program is launched, I want it to be hidden. I'm using a global keyboard hook to respond to a key press and restore the window. This part works fine. It seems that i can hide the dialog by putting ShowWindow(SW_HIDE); in a button handler. So.. it works if i press a button on the dialog but not when the program starts.
This code from Microsoft MSDN does not do anything. But it should:
/* MyDialog.cpp */
#include "MyDialog.h"
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_cMyEdit.SetWindowText("My Name"); // Initialize control values
m_cMyList.ShowWindow(SW_HIDE); // Show or hide a control, etc.
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
I've read in so many places that by putting ShowWindow(SW_HIDE); in the OnInitDialog(), it will hide the dialog when the program starts. It doesn't do anything for my program.
But ShowWindow(SW_MINIMIZE) works in that location for some reason!!!!!!!!
Even by setting the dialogs extended properties in the resource manager (unselecting the Visible checkbox), doesn't do anything.
If i put the ShowWindow(SW_HIDE); in the application's initialization (before the command to CMyDialog.DoModal()), I get an exception message "Debug Assertion Failure"!! Why?!!??!!?!?!??
|
|
|
|
|
|
hey
I want this function to return the location of the first letter of a substring in the searched string
int subsrc(char *target[BL], char *pattern[BL])
{<br />
if (strlen(pattern)>strlen(target))<br />
return NULL;<br />
int first_i;<br />
for (int i=0;i<strlen(target)-strlen(pattern);i++)<br />
{<br />
int j=0;<br />
if (target[i] == pattern[j])<br />
first_i = i;<br />
while (target[i] == pattern[j])
{<br />
i++;<br />
j++;<br />
if (pattern[j] == NULL)<br />
return first_i;<br />
}<br />
}<br />
return NULL;<br />
}
thanks dudes
|
|
|
|
|
xlntbno17 wrote:
I want this function to return the location of the first letter of a substring in the searched string
What about strstr function!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Each of these functions returns a pointer to the first occurrence of strCharSet in string, or NULL if strCharSet does not appear in string. If strCharSet points to a string of zero length, the function returns string.
i SUCK with pointers so help me out here
how would I know what number of the array it would be?
thanks
|
|
|
|
|
xlntbno17 wrote:
Each of these functions returns a pointer to the first occurrence of strCharSet in string, or NULL if strCharSet does not appear in string. If strCharSet points to a string of zero length, the function returns string.
Thats What strstr function defined in string.h do.
Is you have to code your own function for that?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
What would be the best way to extract something between two substrings?
Like if I'm looking through HTML code and i want whats between <tag> and </tag>
from:
"<tag>$20.00</tag>"
i would want to extract "$20.00"
but it could be anything
|
|
|
|
|
xlntbno17 wrote:
Like if I'm looking through HTML code and i want whats between and
Hope this code work well for you!
BOOL CViewSource::Return_Element_Value(const char *lpszOriginalString, const char *lpszElementVar, char *lpszReturnValue)
{
char csOpenTag[20],csCloseTag[20];
int start_pos, ending_pos, closing_br;
int i,j;
char *pdest;
sprintf(csOpenTag,"<%s>",lpszElementVar);
pdest = ::strstr(lpszOriginalString,csOpenTag);
start_pos = pdest - lpszOriginalString + 1;
if(pdest==NULL)
return FALSE;
pdest=NULL;
sprintf(csCloseTag,"</%s>",lpszElementVar);
pdest = ::strstr(lpszOriginalString,csCloseTag);
ending_pos = pdest - lpszOriginalString + 1;
if(pdest==NULL)
return FALSE;
closing_br=start_pos+strlen(csOpenTag);
char *temp=new char[(ending_pos-start_pos)+10];
for(i=closing_br-1,j=0;i<ending_pos-1;i++,j++)
temp[j]=lpszOriginalString[i];
temp[j]='\0';
strcpy(lpszReturnValue,temp);
return TRUE;
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello,
xlntbno17 wrote:
how would I know what number of the array it would be?
Some simple pointer arithmic will do your magic:
char* pszYourString = "This is some string";
char* pszPattern = "some";
char* pszDest = strstr( pszYourString, pszPattern );
int nPos = pszDest - pszYourString + 1;
Look in MSDN[^] for more information on strstr
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
int nPos = pszDest - pszYourString + 1;
There's no need to add one to the result. Doing so creates an off-by-one error.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Well, the + 1 is there in MSDN.. This position in this case, is not the zero based index to an array, but the position starting at 1.
Do VB or Pascal have zero based indices?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|