|
string and wstring are the specializations of basic_string template. Use first with ANSI, second with Unicode.
What function should I use to get the data out of the string to pass it to a Windows API function?
If you just want to pass a const char * pointer, use string::c_str - you can pass this to API functions expecting LPCTSTR. I'm not sure if it's possible to use string as a buffer writable by API.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
So I have to do my only #ifdef UNICODE and define mystring as string or wstring?
Is there any difference between the c_str method and the data method of string?
Thanks for you answers,
Michael
|
|
|
|
|
So I have to do my only #ifdef UNICODE and define mystring as string or wstring?
Yes. Or you can go fancy and use TCHAR:
typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > mystring;
Is there any difference between the c_str method and the data method of string?
Yes - data() doesn't guarantee that you'll get the terminating null character. If the string is empty, data returns "a non-null pointer that cannot be dereferenced" according to docs that shipped with VC6
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello, I've no clue on how to print a specific area of the form on my SDI App. The view class is dialog based. The reason I need to do this is because it has to look the same on the document as on the form - the form has 46 static controls with text and 46 edit boxes - so I have no clue how to print them exactly as they are placed
Any help appreciated,
Deian
|
|
|
|
|
Hi!
In my main dialog (the dialog that appears when I run my app) I have a button that opens a second dialog (the dialog box have a WS_POPUP style), in the main dialog I want to start a timer + change the text of some controls (statics etc.)
Now to the problem: I have code to do that when I close the dialog. But I want to start a timer and change some stuff immediate when I push a button on the second dialog!! HOW!??
/*
BETA
*/
|
|
|
|
|
But I want to start a timer and change some stuff immediate when I push a button on the second
You push on a second dialog and want to change something on a second dialog? Or push on a second and want to change on first?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
are these modaless dialogs u r talkin bout???
|
|
|
|
|
In my program I'm calling a stored procedure (SQL Server) several times. Most of the times it works fine, but eventually I get the following exception:
"Could not allocate a new object descriptor for required system catalog in database '6'. Another database must be closed or objects in another database dropped in order to open this database."
Here's the code that generates the exception:
prsStolpe->MoveFirst();
CString sql;
sql.Format("{CALL TabortBesiktning(%d, %d)}",
prsStolpe->m_LinjeomradeId, prsStolpe->m_StolpeId);
prsStolpe->m_pDatabase->ExecuteSQL(sql);
prsStolpe->Edit();
Initiera();
prsStolpe->Update();
I suspect that the combination of recordset and ExecuteSQL might cause the exception, but then I don't understand why it works fine for several calls before the exception occurs.
I did a search on the exception string and read something about the cause being "resource limitation". What resource would that be?
Please help me out if you can. I'm as confused as a baby in a topless bar.
Thanks!
|
|
|
|
|
Hi,
I have a suspicion that there is a memory leak in a ActiveX App that I am working on.
The reason for the suspicion is the containing application occassionally doesn't redraw correctly.
During this investigation i am going to ignore the activeX technology for the moment.
Anyway, i am sifting through the code to make sure that all mallocs are properly free and dynamic objects destroyed. But surely a problem with one of these wouldn't cause the current symptons.
Some one sugested that the problem might be caused by messages which are left when the app finishes? is this likely? How would i handle it? Anyone any other ideas of what to watch out for?
Thanks Again
Rich
|
|
|
|
|
Can we know the available memory at runtime in other words how can we make sure that our program doesn't have any memory (even a single byre.)?
If anybody knows plz answer me.
|
|
|
|
|
Take a look at GlobalMemoryStatus
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
in other words how can we make sure that our program doesn't have any memory (even a single byre.)?
Your program always uses some memory. What exactly do you want to achieve?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry, the question is incomplete. How can i be sure that my program( program or an activex component)doesn't have any memory leaks and how can i prove it to somebody else.
Thanx in advance.
|
|
|
|
|
Hi,
I'm trying to change the value of a recordset's property. The property is "scroll backwards" (want to change from false to true).
I opened a recordset, and then I got it's properties. I got the wanted property(according to it's index), but I can't change the value - I get an error saying that "the operation can't be done when the object is open".
Which object is the error talking about?
Do I need to change the property after openning the recordset?
What am I doing wrong?
Can someone please send me a code example of what should I do...???
Thanks.
|
|
|
|
|
hey, i know that this will sound stupid, but i can't find any function that changes the static control's text color. Example of doing that?
Thanks,
Deian
|
|
|
|
|
Put this in the OnCtlColor
if(nCtlColor==CTLCOLOR_STATIC )
{
pDC->SetBkColor(RGB(255,9,9));
pDC->SetTextColor(RGB(9,9,255));
}
Replace the RGB values with what you prefer
Regards
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
Such function is not present, you're must override OnCtlColor() function
HBRUSH ...OnCtlColor(...)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_STATIC1)
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor (RGB (255, 0, 0));
}
return hbr;
}
|
|
|
|
|
There's no direct way to accomplish this, and others have already pointed out the method to be used. If you want to save you the pain of writing and maintaining this kind of stuff, why not have a look at Yuri Goltsam's Colored/Blinking Controls and Dialogs with any Font article. Simple drop-in solution. I specially like the idea of providing the functionality as a template class, wish this technique was more widely known and adopted.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks
|
|
|
|
|
hi there...
well im new 2 vc so bear my kiddish query
i have an SDI and have a variable of CString in CDocument...
my view class is of type CEditView and i want to save the
contents typed in the edit view in my doc CString variable and then this variable to disk using the file_save button on the toolbar...
thanx in advance
|
|
|
|
|
Hi, can i know how to use median and averaging filter? My program now can capture real image using digital camera. But how do i reduce the noise using averaging and median filter?? I'm beginner to this and do not know what the filters are for. Please help. Thanks Alot!
Regards,
Michelle
|
|
|
|
|
|
I was just pondering one day ....
Well anyway, how would one go about coding a boot disk, like the win98 boot disk, lilo, norton ghost, etc. What kind of code would be necessary so that the system doesn't give an Invalid System Disk Error?
Well what do you know...I ended up finding something already. Heh. Fugetaboutit!
Stephen Caldwell
Blackfission, CEO
http://bf.steffc.yi.org:81
|
|
|
|
|
|
From a DOS/Win3.1/Win95/Win98 machine, do a "format a: /s"
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|