|
wrote: Can anybody tell me how to place a seprator in toolbar
If you are using the resource editor then slightly drag a button to the right then leave. You will see a separator.
Else through code use
TBSTYLE_SEP .
|
|
|
|
|
Got good help last week for changing text of listCtrl-header and I thougth, my problem is solved. I've the following code:
void koarkstewView::alterheadercontent()<br />
{<br />
LVCOLUMN lvc;<br />
CString titel;<br />
CListCtrl &listCtrl = GetListCtrl();<br />
koarkstewDoc* pDoc = GetDocument();<br />
<br />
karkst *karkstanz;<br />
karkstanz = pDoc->karkstanz;<br />
pDoc->SetTitle("KAR->KST");<br />
int i = 3;<br />
if (karkstanz->wdfirst())<br />
do<br />
{<br />
i++;<br />
titel = karkstanz->wdgetkarnr() + "\n";<br />
titel = titel + gettitel(0, karkstanz->wdgetdatenart(), karkstanz->wdgetvon(), karkstanz->wdgetbis());<br />
listCtrl.GetColumn(i, &lvc);<br />
lvc.pszText = titel.GetBuffer(0);<br />
titel.ReleaseBuffer(); <br />
listCtrl.SetColumn(i, &lvc);<br />
}<br />
while(karkstanz->wdnext());<br />
<br />
}
Works fine - but only in debug-mode!! In release-mode, the text doesn't change
But how to debug the code, if it work's in debug-mode
Any proposals?? Thanks, Gerhard
|
|
|
|
|
ensger wrote: listCtrl.GetColumn(i, &lvc);
lvc.pszText = titel.GetBuffer(0);
titel.ReleaseBuffer();
listCtrl.SetColumn(i, &lvc);
Modify this to,
LVCOLUMN lvc= {0};
listCtrl.GetColumn(i, &lvc);
lvc.mask = LVCF_TEXT ;
lvc.pszText = titel.GetBuffer(0);
titel.ReleaseBuffer();
listCtrl.SetColumn(i, &lvc);
Read this[^] article for better understanding of difference betn release and debug configuration.
|
|
|
|
|
Many thanks, it work's. And thank's for the link. I'll have to read cause I didn't recognice till yet, that programs that work in debug-mode maybe will not work in release-mode.
|
|
|
|
|
ensger wrote: didn't recognice till yet, that programs that work in debug-mode maybe will not work in release-mode
On broader level, in debug mode, lots of things would be taken care of. One of them is variable initialization.
In your case though, you did miss to mention mask. And its always good practice to initialize variables.
|
|
|
|
|
ensger wrote: lvc.pszText = titel.GetBuffer(0);
Why are you calling GetBuffer() unnecessarily? I don't see that you are modifying titel .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Because
lvc.pszText = titel;
results in an error-message like 'no operator defined, that accepts a right-sided operator of type 'class CString''. I didn't even know the existence of 'GetBuffer()' till last week - but it works
|
|
|
|
|
ensger wrote: ...but it works
Of course it does, but GetBuffer() exposes the underlying char* object to possible (unwanted) changes. Try:
lvc.pszText = (LPTSTR) ((LPCTSTR) titel); Now titel cannot be accidentally changed.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I tried and it works. And the sense of this statement is even more obvious for me.
So, many thanks
|
|
|
|
|
Hi all,
Again i m having a problem related to multi threading....
Actually now what i m trying to do is i want to start a thread within a timer that is that thread shold run in particular time intervals...
this i have done it n its workin fi9...
Now my problem is if i have to run this timer for multiple processes like
one timer for that thread s'ld run within 4s sec n other in 5sec like this.......
can anybody plz help me in this.........
thanxs in advance
|
|
|
|
|
I'm not an expert, but i try to help you
It's possibly to start more than one
Timer in a window ( view or dialog )
You have the Handler like this :
void XX::OnTimer(UINT_PTR nIDEvent)<br />
{<br />
switch(nIDEvent){<br />
case TIMER_1: <br />
Timer1Proc();<br />
break;<br />
case TIMER_2:<br />
Timer2Proc();<br />
break;<br />
case TIMER_3:<br />
break;<br />
default:<br />
break;<br />
}<br />
}
TIMER_1 , 2 , 3 is a define
-- modified at 6:53 Wednesday 28th February, 2007
|
|
|
|
|
Each timer can be identified by id.
Watch first parameter of SetTimer .
neha.agarwal27 wrote: it n its workin fi9...
p.s. Dont use SMS like english, for others disliking.
|
|
|
|
|
neha.agarwal27 wrote: ow my problem is if i have to run this timer for multiple processes like
one timer for that thread s'ld run within 4s sec n other in 5sec like this.......
creating new thread every time will be very troublesome as it take some resource.. so if you want to run your thread for 4 sec and 5 sec.. it will run for much higher time depending on CPU condition
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I want to Know how many and what type of controls that are placed in a Dialog Box.
For example :-
i place a Button,CheckBox,listControl,ComboBox.... etc in a Dialog.
from code i want to Iterate all the Dialog Controls in the Dialog and Let me know what controls i have placed in the Dialog.
for(i = 0; i< No of Controls in Dialog ; i++)
{
if(CheckBox) //Alert it is CheckBox.
if(ComboBox) //Alert it is ComboBox.
.
.
.
}
Please let me know it is very urgent.
|
|
|
|
|
Look up GetWindow and GetNextWindow in MSDN.
|
|
|
|
|
CRect rect;
this->GetWindowRect(rect);
CWnd* pWnd = this->GetWindow(GW_CHILD);
CRect rcWnd;
while (pWnd) {
pWnd->GetWindowRect(rcWnd);
if (rcTest.IntersectRect(rect, rcWnd) && pWnd != this) {
}
pWnd = pWnd->GetWindow(GW_HWNDNEXT);
}
|
|
|
|
|
You can use EnumChildWindows ,too.
BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
TCHAR className[256] = {0};
GetClassName(hwndChild,className,256);
return TRUE;
}
EnumChildWindows(m_hWnd,EnumChildProc,0);
|
|
|
|
|
Hi Prasad,
Thank you very much for giving a valuble info. the problem get solved.
|
|
|
|
|
Uday Janaswamy wrote: I want to Know how many and what type of controls that are placed in a Dialog Box.
For example :-
i place a Button,CheckBox,listControl,ComboBox.... etc in a Dialog.
from code i want to Iterate all the Dialog Controls in the Dialog and Let me know what controls i have placed in the Dialog.
GetNextDlgTabItem
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Presently I am using the telnet command to connect an IP address which then asks for an Username and then Password. This is all in CUI mode, i.e from the DOS prompt.
I want an GUI application which will telnet the IP in the background and open an authentication window which will ask for Username & password. When correct Username & Password are supplied, it will connect and show the connection Status.
If possible please help me out in this regard.
Rupak
|
|
|
|
|
Look up sockets/Winsock and RFC854[^] for good places to start.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I've seen what looks to be an excellent article at
http://www.codeproject.com/system/serial.asp
and I shall look at the source code, but what I want to know is if anyone has done any work with RS232 in just simple data reads from scientific equipment, e.g a digital electrometer. If someone has any examples or can point me to some, that would be great. Not even sure I need it to be that clever, it might just be a case of button driven "read data item X" from a dialog, i.e. wouldn't need to be constantly reading/updating.
|
|
|
|
|
Read this[^] article to get started.
I've done quite a few serial communication applications. :->
My approach is similar to the one mentioned in the article above, but I use one thread for writing and one thread for reading with two queues for data to send and data received.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Iam doing an application in VC++..
I want to know how the OS detects the memory drive inserted and loads the driver..
Can any one help me out for this..This is needed for my application...
Sample codes are more helpful..
Thanks in advance..
Regards
vijay
|
|
|
|
|
I beleive that the WM_DEVICECHANGE message is sent when a removable drive is inserted or removed.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|