|
Here is a partial clip for switching toolbars, from "The MFC Answer Book":
UINT nIDFrom = ::GetWindowLong( pBarFrom->GetSafeHwnd(), GWL_ID );
UINT nIDTo = ::GetWindowLong( pBarTo->GetSafeHwnd(), GWL_ID );
::SetWindowLong( pBarFrom->GetSafeHwnd(), GWL_ID, nIDTo );
::SetWindowLong( pBarTo->GetSafeHwnd(), GWL_ID, nIDFrom );
pFrame->ShowControlBar( pBarFrom, FALSE, bDelay );
pFrame->ShowControlBar( pBarTo, bVisible, bDelay );
This example is used to switch between toolbars that only differ in the size of the buttons. It could also be used to switch between a toolbar that contains image buttons and one that uses test buttons instead.
I hope that helps!
INTP
|
|
|
|
|
i use IMsTscAx control to connect to the TS Server.
setting valid server name and so on i finnaly call connect method. he return s_ok. but exploring other property's values i find that startconnected property is false - thats mean that control is not trying to connect. as a sequel connected property is false too.
what do i do wrong?
regards
|
|
|
|
|
Can anyone tell me how to obtain the screen dimensions in an MFC app?
Thanks
|
|
|
|
|
it doesnt seems to be mfc. but its simply call api functions:
GetSystemMetrics(SM_CXSCREEN);
GetSystemMetrics(SM_CYSCREEN);
|
|
|
|
|
|
Get SystemMetrics will do the trick, if you'd like to substract the taskbar of other toolbars => use SystemParametersInfo.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
|
CWnd::GetDesktopWindow()->GetWindowRect (...);
Although this will return the same screen size regardless of the presence of app bars. You probably want the size of the workspace.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
i would like to paste some word text with special characters, őúűöí. my problem is, that they are always converted to simple chars at paste operation, oúuöi.
Is there anyone who can help me out?
Thanks.
Leo.
|
|
|
|
|
Have you used CF_UNICODETEXT as the format when you copied the data into the clipboard?
Jaime
|
|
|
|
|
I paste the text from the MS Word document. The CEdit supports only the CF_TEXT format.
Leo.
|
|
|
|
|
Do somebody know where i can find a word automation example to write a .doc file?
Thanks a lot
tiziacaia
|
|
|
|
|
find your office "compiled help" file. This file has the .chm extension.
Here you can read up about the objects ...
It will not really get you started though.
Search on MSDN and google and idd hope that somebody has a sample code.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
MSDN article Q178749 has an Excel example. Step 9 is the important one as you'll use Word's type library instead of Excel's. Creating an instance of the (Word) _Application object and using its methods will be the same, though.
_Application app;
app.CreateDispatch(_T("Word.Application"));
Documents docs = app.GetDocuments();
CString strFilename(_T("A letter to home.doc"));
_Document doc = docs.Open(COleVariant(strFileName), ...);
...
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks a lot for the answers but now i get a new problem:
error C2065: '_Application' : undeclared identifier
I added word's type library, with classes _Application, _Document and Documents. I tryied to import the .h files but don't work.
I don't understand.
Thanks
|
|
|
|
|
tiziacaia wrote:
I tryied to import the .h files but don't work.
You should have include d, not import ed, msword9.h , preferably in the project's stdafx.h file.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I write "import" but i used correctly the "include". I don't have msword9.h but only CApplication.h, CDocuemnts.h and CDocuments0.h
I added the .h files like you say in the stdafx.h but don't work.
|
|
|
|
|
When you added Word's type library, it would have created a .h and a .cpp file and added those to the project. Can you confirm this?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes, but the created files are only: CApplication.h,CDocuments.h and CDocument0.h
|
|
|
|
|
Hi all,
Is Sleep( )ing too dangerous..??I am using to delay an execution of thread by using Sleep(50) for 50 milli seconds..But my world doesn't seem to accept it..
They call it a bad practice..is it so..??why is it like that..??
Is there anything better than Sleep( )ing in Life..Would be great if you can tell me anyone keeping Multithreaded application in view..
Now where in MSDN or in any standard doc. I could find anything so bad about it..only thing is it's suggested not to sleep when in creating Window UI's it's used..right..??
|
|
|
|
|
When a thread is suspended by using Sleep() , it no longer reacts to any Windows messages.
If the thread is running a window object (GUI, for example), then the window will stop responding to mouse clicks or other events when the thread is suspended. As such, the program appears as if it had crashed, although it is just suspended. Using Sleep() on threads that are not crucial to UI or your program is a working practise. But you should avoid Sleep() with UI threads.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Can hackers access our programs easily when using the sleep()? Would it be OK to use sleep() for private programs that will not be released to the public?
|
|
|
|
|
Hi all,
Is Sleep( )ing too dangerous..??I am using to delay an execution of thread by using Sleep(50) for 50 milli seconds..But my world doesn't seem to accept it..
They call it a bad practice..is it so..??why is it like that..??
Is there anything better than Sleep( )ing in Life..Would be great if you can tell me anyone keeping Multithreaded application in view..
Now where in MSDN or in any standard doc. I could find anything so bad about it..only thing is it's suggested not to sleep when in creating Window UI's it's used..right..??
|
|
|
|
|
Hi all,
Is Sleep( )ing too dangerous..??I am using to delay an execution of thread by using Sleep(50) for 50 milli seconds..But my world doesn't seem to accept it..
They call it a bad practice..is it so..??why is it like that..??
Is there anything better than Sleep( )ing in Life..Would be great if you can tell me anyone keeping Multithreaded application in view..
Now where in MSDN or in any standard doc. I could find anything so bad about it..only thing is it's suggested not to sleep when in creating Window UI's it's used..right..??
|
|
|
|
|
hello Friends,
I have got a table of following structure
Tran_ID Long Integer
Date Date
Type Text
Tran_Number Number
Amount Double
Quantity Double
Dr Text
Desc Memo
The above table is Created in Ms-Access, The main problem is when i use the Select query by using CRecordset object which is opened
CDatabase db;
db.Open("DSN=Test",0);
CRecordset rs(&db);
CString query;
query="Select * from Trans where Date = '08-06-2004'";
rs.Open(CRecordset::snapshot,_T(query));
I am getting an error, Data type mismatch in criteria when the query is to be executed, but where as When i used any other query which can easily match the text, its getting success, only problem with date,
thanking you,
Neelesh K J Jain.
|
|
|
|