|
previous document or previous document template? the twoa re very different creatures
if you need a particular doc template you can iterate thru the list using CApp::GetFirstDocTemplate() and CApp::GetNextDocTemplate()
if you need the previous document you can iterate through the list of docs of that type by using pTemplate->GetFirstDocPosition() and pTemplate->GetNextDocPosition() (where pTemplate is a pointer to the doc template for those doc types)
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hello!
Does anyone know how can we insert two string tables in a dialog based application. And how to load data from each string table.
The string id's in both string tables can be same.
I need it urgent.
|
|
|
|
|
Why do you need two strings with same identifiers? Is this a multi-language app?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Yes it is a multi-language application.
Can u help me plz..
|
|
|
|
|
Create separate resource .dlls for each language, then load appropriate one at runtime. If you're using MFC, check AfxSetResourceHandle function and MFC Technical Note 57 (it's in VC++ help).
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
There are two ways to do this, which way you choose depends on your needs.
1) If you are NT/2000/XP only, then you can simply change the language identifier in VC6 and type a new string. Then, in your app you use SetLocaleID (or something similar, don't have the exact call here) to change which Locale will be the default.
2) If you need to support Win95/98/ME, create seperate resource DLL's for each language and then load the right DLL at runtime. If you're using MFC, you can call AfxSetResourceModule() or something similar (Again, don't have my docs handy) to point to it. If you're not using MFC, then you'll need to specify the DLL's handle when getting the string.
|
|
|
|
|
When I use this function,I get some tousle code.This following is my code.
Anyone can help me and give me some advice?
CInternetSession* cis=new CInternetSession;
CHttpConnection* pHttpCon=cis->GetHttpConnection(_T("192.168.0.17"),INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE,8007);
CHttpFile * pFile;
//pFile=pHttpCon->OpenRequest(CHttpConnection::HTTP_VERB_GET,_T("/a.xml"));
// pFile->SendRequest();
pFile=(CHttpFile *)cis->OpenURL(_T("Http://192.168.0.17:8007/a.xml"),1,INTERNET_FLAG_TRANSFER_ASCII);
CString szSession,szResult("\0");
while(pFile->ReadString(szSession)!=FALSE)
{
szResult=szResult+szSession;
}
//DWORD dwRet;
//pFile->QueryInfoStatusCode(dwRet);
//if (dwRet == HTTP_STATUS_OK)
//{
// pFile->ReadString(szSession);
// }
MessageBox(szResult);
//int n=szSession.Find(_T("Session"));
// if(n==-1)
// MessageBox(_T("Not Find Session"));
pFile->Close();
pFile = NULL;
delete pFile;
pHttpCon->Close();
pHttpCon = NULL;
delete pHttpCon;
cis->Close();
cis = NULL;
delete cis;
|
|
|
|
|
I can see that you use _T(), are you using UNICODE strings?
If you are, it don't work. If you send and receive UNICODE strings, the data you receive is just crap...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
But how can I use the OpenURL() function?Can you give me a sample?
When I try this, I get a error "URL not use a discriminating protocol"
pFile=(CHttpFile *)cis->OpenURL((LPCTSTR)("http://192.168.0.17:8007/a.XML"));
|
|
|
|
|
Thank you.
I have resolved this question by using Function Read() instead of ReadString();P
|
|
|
|
|
OK, I need for my application to catch data in an excel database. So, I know th methode to get data, but when I try to compile my application I have this kind of error message:
"error C2501:'_RecorsetPtr':missing storage-class or type specifier"
what do I have to do to repair this error?
thanks for your help.
Gerald
|
|
|
|
|
> what do I have to do to repair this error?
At least post the line rejected by compiler.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
You have that error because the storage class does not exist. You would need to add a "d" to that storage class for it to find it. The storage class is
_RecordsetPtr
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
What grid does a guru use for manipulating a table(adding,inserting,deleting)?
I use "DBgrid" and "Remote Data" but i dont have a good control of them. For example i dont know how to catch the exceptions like somebody insert a string in a integer field and many more. There is only VB grid documentation and i dont manage VB. There are not many examples too...
If you know VC documentation or source codes about DBGrid,DataGrid, Remote Data or ADO Data let me know, please.
If you integrate the one of the CodeGuru grids in databases (not only for retrieve records) please help me. I can deal with ADO and ODBC.
Whats your advise, dear guru?
Thanks!
|
|
|
|
|
Why not a grid written in C and OleDB/ODBC as DB support? Implement into a DLL a window (not especially an ActiveX), export Register/Unregister from this dll, properties and methods (as every ATL/MFC-like wizard do) as (example):
BOOL
GridCtl_GetColumns(
IN HWND hwndCtl,
OUT PGRIDCOLUMNS **ppColumns
);
etc., implement your own paint for header, lines, columns, cells etc.?
The DB support: you can choose from the myriad of DB interfaces available (starting from ODBC and DB-Library and ending with OleDB, ADO, DAO, Newton binome of A,D and O - - ) and create another dll (or in the same) where you implement the "data source": in the same way, register, unregister, general properties (Server/Source, Catalog/Database etc.), methods/properties (IsBOF, IsEOF, NextRow, Query, Cancel, SetSql, RowCount, GetSql etc.), eventually expose a little rectangle with rewind, back button, in the middle a static with some informations (Connected, Row n Of N etc.) and ending with next/forward buttons (something like: "<< < Row 1 of 10 > >>").
If you need an activex, ok, the ATL object wizard should be a good starting point. Implement what you need (connection points, sinks, events, all the usual stuff).
Frankly, I have seen many controls, from simple windows to ActiveX. But I never seen a grid or a data source to like. So I decided to wrote my controls (including grid) in C. It works, until now.
(RO: Mai pe romaneste: ce faci cu mina ta... )
Cristian 'Sardaukar' Amarie
|
|
|
|
|
I seem to have stubled across my second bug (in about 8 hours worth of using this compiler).
Now, I've always used what I believed to be the standard way of throwing class exceptions (as shown in Stroustrup):
<br />
class AWobbley {<br />
char *m_msg;<br />
public:<br />
AWobbley(const char *msg);<br />
...<br />
<br />
};<br />
<br />
...<br />
<br />
throw AWobbley("AGHRR!");<br />
...<br />
<br />
catch (AWobbley &e) {<br />
... do something with e.m_msg<br />
}<br />
<br />
The problem came up when the exception class stored a dynamically constructed message and, thus, needed a destructor to delete it. In VC++ this destructor is called before the exception handler is entered. This, of course, completely messes up the whole technique.
I haven't yet found a bug report on the Microsoft site. Anyone else with this problem?
Yes, of course there are work arrounds like passing a pointer to a newed object and deleting it at the bottom of the exception handler, but it's ugly and something I wouldn't want to keep for another compiler.
|
|
|
|
|
You need to add the copy constructor to AWobbley and program will behave as expected. If you comment out AWobbley(const AWobbley &a), you'll see two dtor calls and only one ctor - looks like a bug. And the funniest thing is that program doesn't call copy ctor when it is defined.
class AWobbley
{
public:
AWobbley() { printf("def ctor\n"); }
AWobbley(const char *msg) : m_msg(msg) { printf("ctor\n");}
AWobbley(const AWobbley &a) { printf("copy ctor\n"); m_msg = a.m_msg; }
~AWobbley() { printf("dtor\n"); }
void print() { printf("%s\n", m_msg); }
private:
const char *m_msg;
};
void main( void )
{
try
{
throw AWobbley("AGHRR!");
}
catch (AWobbley &e)
{
printf("exception handler\n");
e.print();
}
}
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Now that is weird. I'd say definitely a compiler bug. Thanks for the work arround.
|
|
|
|
|
The stuff that happens without copy ctor looks like bug. Behavior with copy ctor defined may be optimization - the exception object is created 'in-place' once.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Somewhere: "SetTimer(1,10,0);"
10 means the function below is called in every "10 miliseconds"
void CDDDView::OnTimer(UINT nIDEvent)
{
if (nIDEvent==1)
{
//draw a bitmap in different points to simulate an animation
}
}
10 miliseconds is too less for a Pentium II ,so the bitmap cant redraw at every 10 miliseconds.
NOW, THE EXCITING PART:
I have a CTreeCtrl in my view. When i move the mouse over the tree the bitmap redraw 3 times faster!!!!!!!!!
Is there a guru on Earth to explain this???
PS: if somebody wants to see the application i'll send by e-mail. It is my graduated project.
Sorry for not a good English.
|
|
|
|
|
> "SetTimer(1,10,0);" 10 means the function below is called in
> every "10 miliseconds"
No. Windows timers use INT 8 interrupt internally, which fires at 18.2 Hz. The minimal elapsed time is about 55 ms, even if you pass 10 to SetTimer. And, OnTimer is not guaranteed to be called when time elapses - WM_TIMER messages are posted to the message queue and have the lowest priority.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Ok! Ok!
I think i didn't make myself clear!
In my view derived class i have a bitmap who redraws in VM_TIMER handle.I have a tree control, and a multiline edit control too.
Normaly, the bitmap move on the screen with a speed lets say "x".
WHEN I MOVE THE MOUSE OVER THE TREE CONTROL, OR WHEN I SELECT THE TEXT WITHIN A MULTIEDIT CONTROL (FROM MY CView DERIVED CLASS) THE BITMAP MOVES WITH A SPEED "3*x". I KNOW THIS SOUNDS WEIRD!
Why? Why? Why?
|
|
|
|
|
The Windows scheduler boosts the priority of the thread that owns the window, when a window receives input, such as timer messages, mouse messages, or keyboard input. Priority boost gives more processor time and your bitmap is redrawn faster.
BTW: Do you really think that SCREAMING makes you more readable?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
And how comes in the following cases the bitmap doesn't move faster and implicitly Windows scheduler doesnt boost the priority of my thread?
1)Put all my fingers on the keyboard.
2)Click the mouse 5 times a second OUT OF THE TREE and OUT OF THE EDIT CONTROL.
Does Windows scheduler boost the priority of my thread ONLY when my view receives messages from the child windows? How can you explain that?
For you it seems all right. For me not.
Sorry for screaming.
|
|
|
|
|
> And how comes in the following cases the bitmap doesn't move
> faster and implicitly Windows scheduler doesnt boost the
> priority of my thread?
I have no idea - maybe your WM_KEYDOWN handler is glacially slow. You can use Performance Monitor to check what's going on with the priority base/boost. Anyway, if you want smoothly animated bitmap in your program, you'll have to create a separate "painter" thread.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|