|
I have
p.CreateDispatch("DllwithForm.Class1");
p.CheckingPB(hPbWnd,0,100000);
where CheckingPB is triggering repeated messages to be sent to a control. If I uncomment the release dispatch , I am concerned that it will release the dispatch before all my messages have been sent and received. Is this a fact? Since the app isnt working anyways I cant check it out, but wondered if its disastrous if that line is commented out...
Thanks,
ns
|
|
|
|
|
Help people, my head is spinning.....
I have an application that reads images back from a database into a directory. I need to 'touch' the file time stamp to match the database. The date field to retrieved as a COLEDATETIME and I need to convert this to a FILETIME in order to call the win32 SetFileTime() function.
Anyone any idea's how to perform this conversion (I'm sure is really obvious and the constructor for COLEDATATIME lets you do it the other way around!) --- Anyone any clues?
|
|
|
|
|
Use COleDateTime::GetAsSystemTime, then ::SystemTimeToFileTime.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
That works a treat!
Many Thanks.
Kevin.
|
|
|
|
|
I want to add an entry to the registry that all
users on the machine inherits. Is this possible?
|
|
|
|
|
|
hello,
Is it possible to have CreateDIBSection to allocate the bitmap in system memory rather than in video memory (without DDraw) ?
|
|
|
|
|
CreateDIBSection allocates bitmap data in 'system' memory, not in video memory.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
The fourth parameter of CreateDIBSection (VOID **ppvBits) gives me values over 0x80000000, is it still system memory ?
|
|
|
|
|
|
It's just because I make memory access and they seem to be slow.
Never mind, I'll do more tests.
Thanks.
|
|
|
|
|
We delete an array of char this way:
delete[] str;<br />
str=NULL
But, if the string is created like str=_T("test"); or #define str _T("test") , trying to delete it results in an exception.
Now, my question is this: how can I figure out if the string is deletable or not? (must be a const prob)
I know I should strcpy those strings before use, but lazy me...
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|
|
There's no portable way of determining if object is on the heap or not. Switch to std::string or CString and forget about it.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
You can't.
Well, not without keeping some extra information anywhere.
Really this is a design problem, not an implementation problem - it's good practice to allocate and free memory at the same level of a program, so that level already knows how it allocated the memory.
For example
char* str = new char[100];
somefunction(str);
delete[] str;
char* str = "Hello world";
somefunction(str);
// No need to delete anything
The point is that "somefunction" didn't allocate the memory so it can't know how to free it and shouldn't try.
Basically whenever you allocate some memory you need to think about how it's going to be freed, and ensure that it's done at the same level as it was allocated, which is probably the only place that knows how to do it.
|
|
|
|
|
You may want to try with IsBadWritePtr . Do some experimentations with it to see how it handles strings (literal and dynamically-allocated strings).
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Or, just
try{ delete[] str; } catch(...){}
...make it about Visual C++, and don't ever mention Visual Basic. Nick Hodapp (MSFT) in Semicolon[^]
|
|
|
|
|
I used to code java like that! Does it work for c++ too?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|
|
Try
const LPCSTR str = _T("test");
and when the compiler complains about const do as it says. Don't cast the const away
Todd Smith
|
|
|
|
|
I want to print a page which has predefined area, so that the printer prints the content which is in the defined area.Say for example, a document usually has 32x13 inches ruler. we predefine the size to 8x11 inches area of the document. we actually need to print the content of the 8x11 inches?
any help will be greatly appreciated. i desperately need this info. please send reply to vgkotha@rediffmail.com
thanks in advance,
from
venu:confused
|
|
|
|
|
Do you mean you want to print to a selected area of the page?
If you do, override the OnPrepareDC() function and modify the pInfo->m_rectDraw member var to limit the printable rectangle to your app to the area of interest.
You can do that by using something like:
pInfo->m_rectDraw.left = pDC->GetDeviceCaps(LOGICALPIXELSX) * inches_offset1 ;
pInfo->m_rectDraw.top = pDC->GetDeviceCaps(LOGICALPIXELSY) * inches_offset2 ;
And so on...
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Hi all,
I use IDiskQuotaControl->FindUserName() and IDiskQuotaControl->AddUserName() to add quota entry to a network shared volume for every user.
But There are miss match of the function parameters between the Visual studio promotion and the search result of F1 help.
The Visual studio promotion after I type the funciton name and the "(" is:
///////////
HRESULT FindUserName(LPCWSTR pszDomain,
LPCWSTR pszName, PDISKQUOTA_USER **ppUser);
/////////
but when I search use F1 help:
the result is:
///////////////
HRESULT FindUserName(
LPCWSTR pszLogonName,
PDISKQUOTA_USER *ppUser
);
Then I tried the first function. compile and link ok but when execute to it, a Debug Error! occurce:
/**************
Debug Error!
Program: ***
Module:
FIle:i386\chkesp.c
Line: 42
The value of ESP was not properly saved across a funciton call. This is usually a result of calling a function declared with one calling convention with a funciton pointer declared with a different calling convention.
***************************
I suspect that the error was caused by the reson that there are two functions one is we used and can compile and link but the real function in some dll is the other one.
But when I use the second one in code, it can not be compiled. say the this funciton does not take two parameters.
And the same situation with the AddUserName()
Does any one know how to sovle this problem?
Thanks very much for your help.
Laura.
Bu
|
|
|
|
|
This is a general problem for me that I've still not worked out properly even though I've been hitting it for the last couple of years. Reading files with CArchives I can never stop them reading too much of the file and causing a GPF. An example for just now would be I'm using CSockets, so I've got a CSocketFile and a CArchive object as well. I'm using it as part of an ftp client and at the moment its at the point of logging in to the ftp server. There is a big(20 line) welcome message on the server so I need to read this data from the CArchive. When I do a straight
archivein >> stringtxt;
I only get the first 3 lines of the welcome message. When I try
while(!archivein.IsBufferEmpty())
{
blah;
}
I get that the buffer is always empty so it never goes into the loop. As a last resort I tried changing it to make sure it looped.
while(archivein.IsBufferEmpty())
{
blah;
}
I know that code is wrong but it got into hte loop at least but obviously it went into an infinite loop so it was useless.
I tried using archivein.ReadString() but this always causes GPFs. A basic example is.
while(receivedFromServer = archivein.ReadString(buffer,100))
{
blah;
if(receivedFromServer == "")
return;
}
but that just totally craps out on me
Any hints on generally dealing with CArchives, using CArchives with CSockets or with reading files in general.
thanks for reading the most obscure and confused question ever
|
|
|
|
|
If I have a button, and made an OnButton function for it by dbl clicking the button in design view, and then I want to delete it what all needs to go in the code? I see thats theres reference to it in the gray regions of the code(message maps etc), and one time I deleted something from the gray area and the app got destroyed. So do we or do we not delete stuff from the 'gray'areas?
Thanks,
ns
|
|
|
|
|
u do, if u attached a member variable to it, search for all the occurence of it and kiss her goodbye!
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
So the following is not a cause for concern? I am free to go and comment out lines in the gray areas? I tried it on a very simple app and it seems to work, but I am afraid to try it on my mainproject.
BEGIN_MESSAGE_MAP(CEnchangeView, CFormView)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
<code>
ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
Thanks,
ns
|
|
|
|