|
|
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.
|
|
|
|
|
Hello Neelesh,
Take the query string, and open up Access (if you have it). Then execute the query as is and see the results. I suspect that there is a syntax error in the SQL statement.
Found here at Code Project, there is an ODBC Query Tool available for download that is extremely effective in creating working ODBC query strings that fetch data correctly. What I mean by this is that it is most probable that the query string you create contains a syntax error. The quotes and double-quotes that are required by some SQL query strings are problematic when it comes to C++.
First, using ODBC Query Tool, create a query string that fetches the data properly. Then copy this string as is into your C++ code. If you need double-quotes, place a forward-slash '/' in front of them on the string, so they are treated properly.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Neelesh K J Jain wrote:
query="Select * from Trans where Date = '08-06-2004'";
You are not taking the time into consideration, nor are you using the # symbol for date types. You'll need something like:
query = "SELECT * FROM Trans WHERE Date BETWEEN #08/06/2004 00:00:00# AND #08/06/2004 23:59:59#";
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hello Friends,
I have got a table of following structure
|
|
|
|
|
Hi
I made three property pages on a property sheet.
Page1,Page2 and Page3.
A property sheet contains three button (OK, Cancel and Apply Buttons).
I also made three - dialog box.
Dialog1,Dialog2 and Dialog3.
Now ,I would like to do that when we select page1 and click on OK button on
a property sheet then dialog1 should be called.Similarly,when we select page2 and click
on OK button on a property sheet then dialog2 should be called. Similarly on page3.
I wrote some code:-
BOOL CPropertySheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (LOWORD(wParam)==IDOK) {
CPage1* page1;
page1=(CPage1*)GetPage(0);
page1->UpdateData(TRUE);
CDialog1 dlg1;
dlg1.DoModal();
page1->UpdateData(TRUE);
CPage2* page2;
page2=(CPage2*)GetPage(1);
page2->UpdateData(TRUE);
CDialog2 dlg2;
dlg2.DoModal();
page2->UpdateData(TRUE);
CPage3* page3;
page3=(CPage3*)GetPage(2);
page3->UpdateData(TRUE);
CDialog3 dlg3;
dlg3.DoModal();
page3->UpdateData(TRUE);
return TRUE;
} else
return CPropertySheet::OnCommand(wParam, lParam);
}
What should I write the code ?
Any help appreciated .
rajesh
|
|
|
|
|
Something like:
BOOL CPropertySheet::OnCommand( WPARAM wParam, LPARAM lParam )
{
if (IDOK == LOWORD(wParam))
{
int nIndex = GetActiveIndex();
if (0 == nIndex)
{
CDialog1 dlg;
dlg.DoModal();
}
else if (1 == nIndex)
{
CDialog2 dlg;
dlg.DoModal();
}
else if (2 == nIndex)
{
CDialog3 dlg;
dlg.DoModal();
}
}
...
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
SC_HANDLE SCManager = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
This function works when i am administrator. but when i run this function as a user(other than administrator), it returns NULL.
why is it so?
can anyone help?
|
|
|
|