|
I know the following is not vc++ terms, but i am not sure what the equivalent.
How can i "pack" and "zap" a recordset?
I would like to do this on either the open or close of the recordset.
this is my current open statement
CRecordset::Open(nOpenType, lpszSql,CRecordset::FlushResultSet|CRecordset::skipDeletedRecords | CRecordset::useBookmarks);
i though the flushresultset() would do this form me.
thank you.
|
|
|
|
|
First off, I'm very new to IDL, so please be kind
I'm trying to create an interface in an idl file with the following methods:
[id(1)] HRESULT Add([in] BSTR bstrFraction1, [in] BSTR bstrFraction2, [out, retval] BSTR* pbstrSum);
[id(2)] HRESULT Add([in] BSTR bstrFraction, [in] double dReal, [out, retval] double* pdSum);
[id(3)] HRESULT Add([in] BSTR bstrFraction, [in] long lWholeNum, [out, retval] long* plSum);
I assume this would work since the functions all have different signatures, but the MIDL compiler complains that I'm redefining Add(...). So, does IDL not support method overloading?
|
|
|
|
|
I learnt VC++ using MFC approach. Now I can create application programs very quickly, but the problem is that I can't "experiment" with window. I mean that I can only use the window that is provided by MFC framework. I don't know how to subclass a window. For example the tabs of property sheet normally appears on the top. What i have to do if i want these tabs to appear at the bottom. And infact many questions like these always tickles in my mind. Please suggest me the correct way of learning VC++ so that I can create my own style window from the scratch rather than using framework provided window. I shall be grateful if you suggest me good books that suits my needs as i discussed above.
Saad
|
|
|
|
|
Check out the following
Subclass tutorial
A quick tutorial(Chris Maunder) on control subclassing...i think it uses a CButton as example
Have a day
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|
Hi all !
i have a little problem with the function Format("..") in CString MFC class. When i compile in UNICODE and debug my application, this little code doesn't work :
DWORD dw = 0x123456;
CString str;
str.Format(_T("%x"), dw);
At this moment, the variable str contains the first character of dw. Here, str equals to "1".
Can anybody help me ?
Thanks in advance.
|
|
|
|
|
Tool Options has a setting somewhere that lets the debugger display unicode strings - maybe that needs to be set...
|
|
|
|
|
This is a simple question though I can't seem to figure out the 'right way' of doing it. I have a dialog window with only a listbox and a titlebar. What is the best approach to make the listbox fill the entire window (with room for the title bar as well)? I'm using just a simple dialog and listbox resource and am not using MFC so I'm assuming there some message sending that will need to be done.
Any information or even just a poke in the right direction would help.
Sean
|
|
|
|
|
Use GetCLientRect to find out the size of the Window and MoveWindow or SetWindowPos to resize the control.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Will GetCLientRect return the size of the ENTIRE window or the window-toolbar (aka the client area)? I'm assuming I have to do this on WM_RESIZE as well?
Sean
|
|
|
|
|
It will return the rect of the client area, the area WM_PAINT can draw on. GetWindowRect will return the whole window, in screen co-ordinates. It's GetClientRect too, I made a typo...
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
No. Just handle the WM_SIZE.
CListBox* pListBox = (ClistBox *) GetDlgItem (IDC_LIST_BOX);
if (pListBox != NULL) {
CRect clientRect;
GetClientRect (&clientRect);
pListBox->MoveWindow (&clientRect);
} /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
LRESULT CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RECT rect;
HWND hList;
GetClientRect(hDlg, &rect);
switch(uMsg)
{
case WM_SIZE:
hList = GetDlgItem(hDlg, IDC_MYLIST);
MoveWindow(hList, rect.left, rect.top, rect.right, rect.bottom, TRUE);
break;
}
}
Hope i didn't forget anything...
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|
How do I go about porting a macro with the following definition:
<br />
#define addText(format, args...) \<br />
{ \<br />
nLenRest = nMaxLen - strlen(szDest); \<br />
snprintf(szTemp, sizeof(szTemp), format, ##args); \<br />
strncat(szDest, szTemp, nLenRest); \<br />
}<br />
It can be invoked like this:
<br />
void xyz(char *szDest, int nMaxLen)<br />
{<br />
int nLenRest;<br />
char szTemp[8192];<br />
<br />
memset(szDest, 0, nMaxLen);<br />
addText("==== Partition Image: compilation options used ====\n");<br />
}<br />
Thanks for the help!
|
|
|
|
|
That looks completely non-standard. Macros can't have a variable number of parameters, since they aren't functions. And the ## operator makes no sense there either.
--Mike--
"COM didn't solve the old version of DLL hell - it just provided us with a new and improved version of hell."
-- John Simmons, 1/22/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Well, it works like a charm under GCC, but not on MSVC6...
|
|
|
|
|
You could always make it an inline function if you want to.
|
|
|
|
|
So how do I go about doing that??
|
|
|
|
|
That's to be expected when using nonstandard constructs.
--Mike--
"COM didn't solve the old version of DLL hell - it just provided us with a new and improved version of hell."
-- John Simmons, 1/22/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Macros in VC++ 6 cannot have variable number of parameters. I would probably make this a function.
Matt Gullett
|
|
|
|
|
But the power of the macro lies in taking named parameters in it's body as shown in the example... That would just go to waste
|
|
|
|
|
Hi people,
Does anyone know whether the order of evaluation of terms in an expression can be guaranteed by the C++ compiler to be the same as the order that these terms appear in the code? For example, consider the following:
bool A();
{
}
bool B();
{
}
...
if ( A() && B() )
{
....
}
Can I safely assume that, no matter what the optimization settings are, function A() will always be called before function B()?
Also, can I assume that if A() returns "false", then B() won't be called at all?
Does the same thing hold for inclusive OR?
(i.e. in the statement "if ( A() || B() )" will A() be called first and is B() going to be called anyway if A() returns "true"?)
Thanks very much for the help.
|
|
|
|
|
valtrig wrote:
if ( A() && B() )
If not A(), B() will not be called.
valtrig wrote:
if ( A() || B() )
If A(), B() will not be called.
Sorry, no Stroustrup or Standard refs to back this up. Just the way I code it.
|
|
|
|
|
Both && and || short-circuit, and always have. In if( A() || B() ) the evaluation stops if A() returns true (opposite of && ) because the value of the whole || is guaranteed to be true regardless of the value of the right operand.
--Mike--
"COM didn't solve the old version of DLL hell - it just provided us with a new and improved version of hell."
-- John Simmons, 1/22/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I decide to make my app multithreaded but when I call _endthread():
"First-chance exception in 14.exe (KERNEL32.DLL): 0xC0000005: Access Violation."
Maybe I don't free all memory that I've reserved by new operator.
Please help.
|
|
|
|
|
Look at the call stack and try and pin point the location of access vilation.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|