|
led mike wrote: Also reading this might help as well.[^]
That IS a good link. I bookmarked that to post in the future,
Thanks!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In addition to super_ttd's reply...
If you must use fopen(), then you should probably use a CStringA.
CString has a generic internal character type, depending on whether
UNICODE or _UNICODE is defined.
If you want to use the generic text CString, then it will pair nicely
with the generic text version of fopen(), which is _tfopen().
Gut Mikh Tappe wrote: char buffer[MAX_PATH];
GetModuleFileName(NULL,(LPWCH)buffer,MAX_PATH);
Bad cast!! GetModuleFileName takes a LPTSTR as its second parameter.
Your buffer, therefore, should be a TCHAR type, not char.
Mind your types.....if you need a cast to get something to compile, look at WHY.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
May you please give me an article about UNICODE ?
Regards
Mahdi
|
|
|
|
|
|
Hello all together!
In my current project i am trying to add a scrollbar to a CStatic control. This CStatic control is placed dynamicaly on a CWnd using Create(...). The scrollbar is provided with the CScrollHelper class and the scrollbars are already visible. My problem is that the scrollbars can not be used...i think the events are not passed to the CStatic...
Has anyone an idea how to do it?
|
|
|
|
|
MrNyquist wrote: Hello all together!
Hello singularly!
MrNyquist wrote: Has anyone an idea how to do it?
Looks like this guy might.[^] Notice there is a forum at the bottom of the article for asking questions about using CScrollHelper
led mike
|
|
|
|
|
ok, i know this article and the forum at the bottom ...
but i did not find an approach for my problem. (scrolbars are not accessible on a static control)
|
|
|
|
|
|
I've implemented a custum control deriving a class from CStatic
and performing a custom drawing.
This controls works fine when I put it in a Dialog (calling
Mycontrol.Invalidate() - in MyDialog class - causes control redrawing).
If I put the same control in a DialogBar calling
Mycontrol.Invalidate() doesn't causes control redrawing, I've to
call MyDialog.Invalidate(): in this way the whole DialogBar
is redrawn and Mycontrol is redrawn within it.
Whats is this different behaviour due to ?
Thanks
|
|
|
|
|
Hi, please try calling UpdateWindow after Invalidate. It should work in both cases.
Best regards,
Mihai Moga
|
|
|
|
|
Hi All
How can i set background image on dailob box and button in vc++ 2005?Plz help me
|
|
|
|
|
|
Davitor wrote: How can i set background image on dailob box and button in vc++ 2005?
At the top of my head two ways comes to mind:
1. override OnDraw() and draw the image youself
2. create a picture control behind the other controls in the dialog
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
For dialog you can use of CImage class and for button you can use of SetBitmap.
|
|
|
|
|
I have one excel file on my system . Is there any api to connect my MFC application with
the excel file so that I update particular cell from my MFC application and that takes place
in the excel file .also vice versa is true i.e any change in excel file cell I get the event in
my MFC application.
Trioum
|
|
|
|
|
trioum wrote: Is there any api to connect my MFC application with the excel file so that I update particular cell from my MFC application and that takes place in the excel file
That can be accomplished by automating Excel through COM interfaces, even if you don't know the file format.
trioum wrote: also vice versa is true i.e any change in excel file cell I get the event in
my MFC application.
In that aspect the file with the Excel spreadsheet is just a file, i.e. anything you can do with a file you can do with the Excel document.
This means that cannot be asynchronously notified if a file has changed without a filter driver. Even if you had such a filter driver the only thing it could do would be polling whether the data that correspond to the cell you desired has changed or not, or be as basic as telling "the file has changed".
What you can do is tag the modification time of the Excel document and check the file time yourself. If the file has been modified you can open it in Excel, again through automation, and investigate the desired cell for changes.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
trioum wrote: Is there any api to connect my MFC application with
the excel file so that I update particular cell from my MFC application...
See here and here and here and here.
trioum wrote: ...also vice versa is true i.e any change in excel file cell I get the event in
my MFC application.
See the first part of this article.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
I need to use EnumDisplayMonitors at my class.
BOOL EnumDisplayMonitors(
HDC hdc, // handle to display DC
LPCRECT lprcClip, // clipping rectangle
MONITORENUMPROC lpfnEnum, // callback function
LPARAM dwData // data for callback function
);
there is MONITORENUMPROC - pointer to a function
BOOL CALLBACK MonitorEnumProc(
HMONITOR hMonitor, // handle to display monitor
HDC hdcMonitor, // handle to monitor DC
LPRECT lprcMonitor, // monitor intersection rectangle
LPARAM dwData // data
);
here is my code.
MONITORENUMPROC pEnumMon;//pointer to my function
//my function
BOOL CALLBACK MyPaintEnumProc(HMONITOR hMonitor,HDC hdc,LPRECT lprcMonitor, LPARAM data){
return true;
}
and now
this->pEnumMon = &MyClassName::MyPaintEnumProc
But it doesn't work.
Error 1 error C2440: '=' : cannot convert from 'BOOL (__stdcall MyClassName::* )(HMONITOR,HDC,LPRECT,LPARAM)' to 'MONITORENUMPROC'
What am I doing wrong?
Thank you very much.
|
|
|
|
|
daavena wrote: Error 1 error C2440: '=' : cannot convert from 'BOOL (__stdcall MyClassName::* )(HMONITOR,HDC,LPRECT,LPARAM)' to 'MONITORENUMPROC'
What am I doing wrong?
Have you declared the member function as static , as I suggested here[^]?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
You are right.
I forgot declare it as a static function.
It's working.
THANK YOU VERY MUCH.
|
|
|
|
|
initially i am displaying 1 dialog box with two buttons. if user clicks 1st button it will some dialog box and if user clicks 2nd button then it should display the another dialog box.
May i know how to switch from 1 dialog box to another dialog box accordingly?
Thanks in advance
|
|
|
|
|
you are probably talking about the functionality of creating a Wizard using CPropertySheet and CPropertyPage...
Read about CPropertySheet and CPropertyPage these two classes and see if they match your needs.
I hope they will
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Anjali Patil wrote: May i know how to switch from 1 dialog box to another dialog box accordingly?
By clicking the other button, I presume.
Your description is a bit unclear. "Switching from 1 dialog box to another dialog box" implies that both are on the screen simultaneously. This would require one of them to be modeless. Otherwise, as has already been mentioned, a property sheet with two pages seems like your best bet.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
Using C++ code, I could not place the flashing caret at the beginning of the Single Line Edit Box after selecting the whole text in it.
In the function
void SetSel(int nStartChar,int nEndChar,BOOL bNoScroll = FALSE );
of CEdit class, the start and end character positions can be given to select some part of the whole text. For full selection, we need to use as SetSel(0, -1);. In both cases, the flashing caret is always at the end of the selection irrespective of the order of the start and end positions in the above function.
In the description of EM_SETSEL Message, I found the below mentioned point.
"The control displays a flashing caret at the end position regardless of the relative values of start and end."
Could anyone help me in this regard.
Thanks,
Kishore
modified on Friday, October 10, 2008 6:54 AM
|
|
|
|
|
What's your question?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|