|
SilverShalkin wrote:
char r[256];
if (r == "ok")
To answer your original question, that code compiles because both sides of the comparison can be converted to the same type.
"ok" is of type char*
r can be converted to char* through language rules. A one-dimensional array can be implicitly converted to a pointer to the element type, so char[] becomes char* . Voilà.
--Mike--
Best score on the mini-putt game: 26
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
I stand corrected.
|
|
|
|
|
I was wondering if someone out there could help me out. Why wont the
following code work
//I have a clistctrl as member variable of the following dialog and want
//to catch messages sent from the clistctrl within this dialog
BOOL TVC_RC_Dlg::OnChildNotify( UINT message, WPARAM wParam,
LPARAM lParam, LRESULT* pLResult)
{
switch ( message ) {
//this case is just an example of one
//of the many im after
case LVN_BEGINLABELEDIT: //Or any other msg sent from a clistctrl
return 0; //Execution never gets here
break;
default :
break;
}
return CDialog::OnChildNotify(message, wParam, lParam, pLResult);
}
Thanks to anyone who can help, or anyone who even read my question
lm
|
|
|
|
|
OnChildNotify would be executed on the list control itself, not it's parent dialog. Use OnNotify instead.
|
|
|
|
|
I have designed a control currently derived from CView, but i'm gonna convert it to a CWnd instead. However I would like to later wrap the CWnd control in a CView like CTreeCtrl is with CTreeView.
How would I go about doing this...
Where is the implementation for CTreeView...?
learn from example kinda thing. It looks like the CView wrappers just return a reference to the CWnd control, which seems simple enough.
Anybody got any suggestions for me..?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
IMHO it handles WM_SIZE message and resize control accordingly
|
|
|
|
|
I want to have an option in my program which will let the user specify a folder for keeping the log files. This folder should not be accessible (no read, no write, and nothing else) by anyone EXCEPT System and Administrator. How do I do this? Could someone give me an example code to explain things a bit? The target system would be NT/2000 servers. Any help or pointers would be greatly appreciated.
Thanks,
impuzible
|
|
|
|
|
I have a class delived from CWnd and in OnNCPaint is the code for drawing color edge(border) of control. I need draw scrollbar myself because this code is not optimal(it blink ) :
void CMyClass::OnNCPaint(){
CWnd::OnNCPaint();
CWindowDC dc(this);
CRect rect;
GetWindowRect(rect);
dc.Draw3dRect(0,0,rect.Width(),rect.Height(),RGB(0,255,0),RGB(255,0,0));
}
Thanks!
|
|
|
|
|
Hmmm... I don't know what type of control you're trying to paint, but scrollbars usually are inside the client area (I think).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I thought so too. They do flicker quite a bit though while in the client area...I don't know if non-client area would be any better though. Do you think it's because the entire client area is getting invalidated instead of just the drawing area inside the client area...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Well, it depends. 'Internal' scrollbars maintained by Windows are drawn outside client rect. If you create them yourself as controls, they will cover parts of client area.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
If internal scrollbars are drawn outside the client rect, this means they shouldn't flicker right..?
I've never actually used internal scrollbars...i've always liked the freedom of adding buttons between the scrollbars. However they are usually created inside the client area and get redrawn on every invalidate() which causes crazy flicker. Do the system scrollbars flicker? Cuz i'd do away with my buttons for the trade off of no flicker.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
The reason they flicker is that you're drawing the client area and then windows draws the scrollbars on top.
Theres an article somewhere on MSDN about why scrollbars are drawn internally and hence can't be customised.
when i did a sort of skinned app, the only way i could get scroll functionality with nice looking scroll bars was to bodge a CFormView onto my dialog, and then use a custom written control to be a scrollbar, and scroll the view window internally. it was messy but it worked.
jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I don't think you can paint the scrollbars yerself in the OnNCPaint...
You probably have to derive clases from CScrollBar make them owner drawn and do it that way.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hey guys
The function below is being called by rundll32.exe but whenever i run it i get a memory violation saying :-
The instruction at "0x77f52ff9c" referenced memory at "0x002e2afd. The Memory could not be "read"
// DLLVerifySignature - Allows Verification on double click
bool DLLVerifySignature(HWND hwnd, HINSTANCE hinst, LPTSTR sFileNameAndPath, int nCmdShow)
{
CFullCryptFunc FullCrypt;
FullCrypt.FullVerifySignature(sFileNameAndPath);
FullCrypt.~CFullCryptFunc();
return TRUE;
}
The funtion i call in the FullCrypt class works fine as when i call it from another part of the program i have no problems im guessing that teh problem occurs because the software is not properly initalised when it trys to call this.
Peter
|
|
|
|
|
You'll have to dig deeper - run your .dll under a debugger. Use rundll32.exe as 'Executable for debugging session' under Project Settings/Debug.
When the program crashes, you'll be able to have a look at the stack, local variables, globals, etc.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
So i have a char[20] like "foo foobar foo2" and I want to get
A = "foo"
B = "foobar"
C = "foo2"
if the words could be any length, what is the best way to do this?
tim
---------------------------------------
Tim Booher
|
|
|
|
|
|
what about the extraction operator:
char curRecord[20];
char cDay[3];
while(!osMyFile.eof()) // we go through each line in the file
{
osMyFile.getline(curRecord,20); // read time value
curRecord >> cDay;
cout << curRecord << "\t" << cDay << endl;
}
---------------------------------------
Tim Booher
|
|
|
|
|
|
i am sorry, but i don't get it what do you mean?
---------------------------------------
Tim Booher
|
|
|
|
|
He is just saying that strtok is a nice simple routine while strstream is this huge library with a lot of extra baggage.
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?
|
|
|
|
|
o.k. so I have:
while(!osMyFile.eof()) // we go through each line in the file
{
osMyFile.getline(curRecord,20); // read time value
ins >> intDay;
ins >> intTime;
ins >> strOnBay;
cout << intDay << "\t" << intTime << "\t" << strOnBay << endl;
}
this is so close to working -- the only problem is that, while it loops through the file, it keeps putting the same value in intDay, intTime and strOnBay each time . . . (i.e. they never change)
thanks,
tim
---------------------------------------
Tim Booher
|
|
|
|
|
Where did that ins come from? Rewrite your code like this:
...
osMyFile.getline(curRecord,20);
<font color=#ff0000>istringstream ins(curRecord);</font>
ins >> intDay;
...
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks! works great!
---------------------------------------
Tim Booher
|
|
|
|