|
Hi,
Could anyone here recomend a good SDK/Libraries/Sources that will enable me to use IMAP from my application?
I am developing in C++, however I am open to any suggestions.
I have checked componentsource who seem to have a lot of PowerTCP and IPWorks componenets. Is there another site that might have more veriaty?
Thanks,
Jeremy.
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
i have a c++ sample which generates a active control in exe format, readme says it can be used in VB.
i have no idea how to use it in vb.
if u know VB, please give me a clue for quick start
thx
includeh10
|
|
|
|
|
You mean an ActiveX control ?
I don't know how to use it in VB but try asking at the VB forum.
|
|
|
|
|
in dll.
class a{
CPoint * p;
}
a::a{
p = new CPoint[30];
}
a::~a{
delete p;
}
in exe.
{
A * pa = new a;
delete pa;
}
When the project setting for my application is 'Use MFC in a Shared DLL', there is no problem. But when the setting is 'Use MFC in a Static Library', the compiler gives errors in Released mode, and in Debug mode the .exe is built but this time i face with 'Debug Assertion Failed!'(ASSERT(_crtIsvalidheappoint() ) errors when i run the application.
Thanks for help
|
|
|
|
|
a::~a{
delete[] p;
} You must match forms of new and delete . If you allocated an array, use delete[] . If you allocated a single object, use delete .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have done it, but it doesn't help.
|
|
|
|
|
Sorry, I should have read more thoroughly. You shouldn't have one binary in the same process linked to the static version of the C runtime library and another linked to the DLL version. If more than one binary uses the C runtime, they should all use the DLL version.
One of many reasons is that the C runtime creates a new operating system heap (using the HeapCreate function) during CRT startup, for all allocations made using the C or C++ runtime libraries. Each instance of the CRT (a statically-linked copy of the CRT counts as a new instance) creates its own heap. See HEAPINIT.C in the CRT source code.
You can't allocate from one heap but free from another. The effect of your code is that the code from a::a (and hence the memory allocation from new ) runs in the context of the code running new a (in this case, your executable), but the memory deallocation runs from the module containing a 's destructor (the DLL). delete therefore tries to free the memory from the wrong heap, leading to the assertion. In a Release build, you won't get the assertion, but you will get a memory leak.
The practical upshot of this is that you must either link all MFC-using components in the same process with the MFC DLL, or never create classes outside the DLL they're implemented in.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks very much! I got it. But I have another question: is there any method to solve "new and delete" problem. In my application, I want to seperate the user interface and the data structure. So I put the data structure in dll and UI in exe. Meanwhile I want to link them both in static library. Is there any method.
|
|
|
|
|
What compiler errors do you get?
What pointer is causing the assertion? (You should be able to 'break' and then look at the call stack)
As pointed out you need to delete an array with delete [].
If the allocation is always 30 why are you using 'new'?
It's possible the problem is related to having your class in a DLL, I'm currently fuzzy on when this matters from a heap pov. Try putting a factory function in your DLL,
A * CreateA ()
{
return new A ;
}
void DestroyA ( A * )
{
delete A ;
} and using that rather than direct 'new' and 'delete'.
In general I'd highly recommend you not use 'new' and 'delete' but use 'std::vector' or another container for the array and 'std::auto_ptr' or another smart pointer for the object.
Paul
|
|
|
|
|
Thanks very much! I got it!
|
|
|
|
|
Hi i want to get HFONT or LOGFONT form HDC object. I have a hdc but i don't wann to do this in this way
<br />
HFONT font= (HFONT)SendMessage( hwnd,WM_GETFONT,0,0);<br />
or in this way
<br />
HFONT font = ::CreateFontIndirect(....);<br />
HFONT hOldFont = (HFONT)::SelectObject(hdc, font);<br />
im looking for something like
<br />
HFONT font=GetFont(hdc);<br />
There must be a way to do this
Pain is a weakness living the body
|
|
|
|
|
Try ::GetCurrentObject(HDC, OBJ_FONT)
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
Thanks!!!!!
Pain is a weakness living the body
|
|
|
|
|
Assuming that you don't want to create a font because it's expensive, what about
HFONT tmp = (HFONT)SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
SelectObject(hdc,tmp);
You don't say why you don't want to use the other methods...
Steve S
|
|
|
|
|
roger's way is what i was looking for
thanks anyway
Pain is a weakness living the body
|
|
|
|
|
Hello,
I want a function which will format some text with carriage returns in it. So that I have a maximum width like 80 characters. If my string is perhaps 180 characters I would like to look through the string and every 80 characters replace the nearest space character to the left of my maximum width with a carriage return. Is there a function that anyone has that can do this?
Thank you
|
|
|
|
|
the screen driver does this automatically.
anyway, you could do the simple (according that your string is str, C-style string):
<font style="color:blue;">int</font> iCpt = 0;
<font style="color:blue;">while</font> (str[iCpt] != <font style="color:purple;">'\0'</font>) {
<font style="color:blue;">if</font> (!(iCpt%80)) {
printf(<font style="color:purple;">"\n"</font>);
}
printf(<font style="color:purple;">"%c"</font>, str[iCpt]);
iCpt++;
}
or the more complex code below (i'm not even sure it works) :
<font style="color:blue;">int</font> iCpt = 0, iResult = 80;
<font style="color:blue;">while</font> (iResult == 80) {
iResult = printf(<font style="color:purple;">"%80s\n"</font>, str[iCpt]);
iCpt += iResult;
}
TOXCCT >>> GEII power
|
|
|
|
|
I do not want to break up any whole words.
I can show you. If my maximum width is 8 characters and this is my text:
aaa bbbb ccccc ddddd eeeeeee fff gg hhhhh
I want to have this:
aaa bbbb\nccccc\nddddd\neeeeeee\nfff gg\nhhhhh
So my result would be this:
aaa bbbb
ccccc
ddddd
eeeeeee
fff gg
hhhhh
|
|
|
|
|
ahh ok, well if you don't say it, how should i guess...
hem, i'm thinking of this :
* add a marker to record the last whitespace you encountered before the end of the line,
* create a buffer 81 caracters long (because of the trailing '\0') where you copy the caracters (and so WORDS) to printf,
* when you encountered the end of a line, or the end of the source string, copy the buffer to the screen
TOXCCT >>> GEII power
|
|
|
|
|
suppose your string is
char str[]="......"
<br />
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) <br />
<br />
int str_len = strlen(str);<br />
int LINE_LEN=7;
int c=(int)ceil((float)str_len/(float)LINE_LEN);<br />
char *str2= new char[str_len+c+1];<br />
int n=0;<br />
int m=0;<br />
for(int k=0;k<c;k++)<br />
{<br />
m= MIN(LINE_LEN,str_len-LINE_LEN*k);<br />
strncpy(str2+n,str+(LINE_LEN*k), m );<br />
n+=m;<br />
str2[n++]='\r';<br />
}<br />
str2[n]=0;<br />
delete[] str2;<br />
<br />
Pain is a weakness living the body
|
|
|
|
|
Hi everybody,
Does anybody know, how I can use a WTL splitter window in an MFC 6.0 project? I want to have a more flexible splitter window in my MFC application. please explain it in detail.
thanks in advance,
Roozbeh.
|
|
|
|
|
wot is the best way to check whether internet is connected.
Other than pinging or downloading file from a known server.
|
|
|
|
|
take a try...
InternetCheckConnection(...)
jitendra
|
|
|
|
|
A function for this is InternetAttemptConnect . This function will check if an Internet connection is available. It returns ERROR_SUCCESS if the connection was available, and if not, it'll return one of the system wide error codes.
Only one parameter, zero, is issued to the function, so it's pretty straightforward to call it. Include 'Wininet.h' and link with 'wininet.lib' to use this function. It is part of the Platform SDK.
For other Internet-connectivity functions, see MSDN link here.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
InternetGetConnectedState(...)
|
|
|
|