|
Did you change the property for Debug AND Release configurations - the properties are (unfortunately, in many ways) set separately.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
And the manifest file...ummm - is the project property Configuration Properties->Linker->Manifest File->Generate Manifest set to Yes in all cases?
Although it may be that XP themes need Unicode.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
done as u told me to do. But no use.
Anyway atleast debug version got somewhat debugged.
Manmohan Bishnoi
|
|
|
|
|
Hi.
I'm stuck with the same problem. Whenever my program receives data from any tcp/ip server, it displays it correctly, but when it sends data back to the server, the latter receives only the first character. Turning off Unicode is not an option, becouse the tcp/ip communication is only a small part of the project, and this change generates lots of other errors. I'm also using the tutorial from David Chapman's "Teach yourself Visual C++ 6...", and Visual Studio 2k8, so my code is almost exactly the same as monu_biosman's.
I'd like to ask Stuart, or anyone else for that matter, what exactly I need to change to make it work. I already made lots of tests, but none seem to work.
iLen = m_strMessage.GetLength();
iSent = m_sConnectSocket.Send(LPCTSTR(m_strMessage), iLen);
iSent = m_sConnectSocket.Send("blablabla", 9);
CString buffer = "blablabla";
iSent = m_sConnectSocket.Send(buffer, 9);
char[1024] buffer;
wsprintf(buffer,"%s",m_strMessage);
iSent = m_sConnectSocket.Send(m_strMessage, 1024);
I'm running out of ideas, or maybe I'm a retard i don't know. Any help would be greatly appreciated. Thanks in advance.
SquiZZlo
|
|
|
|
|
Ok, I've found the answer to my problem on another forum:
iLen = m_strMessage.GetLength();
CStringA ansiString(m_strMessage);
iSent = m_sConnectSocket.Send(ansiString, iLen);
Works prefectly!
|
|
|
|
|
The print dialog for CHtmlView is a non-modal dialog and I would like to know if there's a way to make it modal. It's annoying that you can close the view (in an MDI app) and the print dialog still sits there - if you then ok it you get an error (as expected as the document no longer exists). The MFC OnFilePrint function uses the OLECMDID_PRINT verb but the parameters available for this are vague. The print dialog in IE itself is modal so why should it be non-modal for other applications? Any answers appreciated.
|
|
|
|
|
hi,
i am working on a product based on visual c/cpp.
the product is gui base,and creates window and othe widgets on drag and drop basis.
on creation of a project it creates its own .rc file,a .dat(holds widgets' gui info such as width,color runtime)file,.c,.h and a make file for compiling the application.
now i am facing problem while trying to attach a colored(32x32) .ico file at title bar of a window.
till now i have done:
1.put the .ico file at the correct directory.
2.created a .rc file and put (1 ICON dalocsv.ico) in that file.
3.Now complied the make file with some of the added flags and tha created the .res file which shows the icon at its editor.Also the exe created. But the icon is missing.
CAN SOMEBODY PLZ HELP ME WETHER I AM MISSING SOME STEPS.
OR IS THERE OTHER WAY?????
Thanks in advance
Rajib
|
|
|
|
|
Rajib Podder wrote: i am facing problem while trying to attach a colored(32x32) .ico file at title bar of a window.
As far as I know, the icons in the title bar are 16x16.
If you use file explorer to browse the directory with your exe, you will probably see the 32x32 icon if you select that kind of view in explorer.
Rajib Podder wrote: CAN SOMEBODY PLZ HELP ME WETHER I AM MISSING SOME STEPS.
OR IS THERE OTHER WAY?????
Please don't shout in the forums.
Read the guidelines[^], especially item #6.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
hi,
as i have already...informed that i have the .res file containing the .ico file.
Now my question is that how can i attach the icon inside my application.
I have already described about my application.
or
please let mr know..if there are any other way out???????????????
|
|
|
|
|
Rajib Podder wrote: i am facing problem while trying to attach a colored(32x32) .ico file at title bar of a window
...
the icon is missing
Roger Stoltz wrote: the icons in the title bar are 16x16
Rajib Podder wrote: how can i attach the icon inside my application
As I have already...informed you can't since your icon has the wrong format.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Is ther any other alternative.
Can i attach any image?
if so,Please let me know the procedure
|
|
|
|
|
Hallo,
i have the following code:
void CTest_MyDocumentDoc::Print_Output()
{
m_ptrOutput->Invalidate (true);// m_ptrOutput= (CRichEditView *) m_wndSplitter.GetPane(1,0);
m_ptrOutput->UpdateWindow();
UpdateAllViews(NULL);
}
i have splitted SDI-appliction and i need to call OnDraw() indirectly to print / draw my results in the second part of my splitted sdi App., this code does not work , the OnDraw() does NOT be called ??
|
|
|
|
|
Don't do it that way. Put your code to draw the window in a separate method and call that method from both OnDraw and Print_Output, passing a suitable DC in both cases.
So, if you call it "DrawView", OnDraw would call DrawView, as would Print_Output.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i tried to do it that way before, but i did not have any text drawen on the monitor, i am forced to do it that way, and how can i get a suitable DC ?
please explain in code . thanks
|
|
|
|
|
susanne1 wrote: a suitable DC
OnDraw[^] gives you a screen DC
CPrintDialog/CPrintDialogEx can be used to create printer DCs, if you aren't going to follow the standard MFC printing mechanisms.
So in each case, you have a way of calling your 'draw' code with a suitable DC.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
write now i got every folder mails like for outbox, I used "PR_IPM_OUTBOX_entryid". Like this I got mails from every folder except from junk mail. What is id for junk mail
plz reply, thanks in advance.
sampath-padamatinti
|
|
|
|
|
Hi All,
i am using xmlhttp to fetch data from the server, now i have issue that i am fetching multiple pages one by one for the session, but with some pages i am getting this "Sorry, there are no results for the adjustments that you have selected" in response but data is available in the live environment, i think that i have to use time delay among request but i am not sure what exactly i am missing....please provide some ideas.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
The reason you're not getting results back is probably more to do with the server-side software than with your use of XMLHTTP.
Very difficult to say when you've provided virtually no information.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Good morning ,
just a brief question.
I got a multi-threaded program. Now is it possible to ensure that a certain thread at a certain point won´t lose its 'working permission'.
Hm, don´t know if I expressed that correctly.
I have a thread going into a function where it has to wait for a previously defined time, then go on. The thing is, it waits and waits and at some point its time slot is taken away. When it is given the next slot, though, the time it has waited for has 'long' passed. And thus it´s always too late.
The code in question is:
int RTPEngine::SendRTPPacket( BYTE* data, int size )
{
if( data && size > 0 && m_pHeader )
{
m_pLogger->Out(Logger::DEBUG, "RTPEngine: Sending data package with size %d (excluding header).\n", size);
BYTE* packet = new BYTE[size+12];
BYTE* headerBytes = m_pHeader->GetInc();
for( int i = 0; i < 12; i++ )
{
packet[i] = headerBytes[i];
}
for( int i = 0; i < size; i++ )
{
packet[i+12] = data[i];
}
double now = 0.0;
if( m_dPacketSendTime != 0.0 )
{
now = ((double) clock() / CLK_TCK) * 1000;
int tmp = 0;
while( now <= m_dPacketSendTime )
{
if( tmp >= 20 )
{
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Time now = %f, send time = %f.\n", now, m_dPacketSendTime );
tmp = 0;
}
tmp++;
now = ((double) clock() / CLK_TCK) * 1000;
}
}
now = ((double) clock() / CLK_TCK) * 1000;
int rc=sendto(m_oUDPSocket,(char*)packet,size+12,0,(SOCKADDR*)&m_oUDPAddress,sizeof(SOCKADDR_IN));
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Packet sent at = %f.\n", now );
m_dPacketSendTime = ((double) clock() / CLK_TCK) * 1000;
m_dPacketSendTime += (m_dPacketLengthMillis*(1.0 - m_dRTPOverlap));
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Next send time = %f.\n", m_dPacketSendTime );
return size;
}
else
return 0;
}
And one more thing is, on my Vista machine it works fine. The logger prints this:
RTPEngine: Next send time = 53637.795918.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
.
.
.
RTPEngine: Time now = 53636.000000, send time = 53637.795918.
RTPEngine: Time now = 53636.000000, send time = 53637.795918.
RTPEngine: Time now = 53637.000000, send time = 53637.795918.
RTPEngine: Time now = 53637.000000, send time = 53637.795918.
RTPEngine: Time now = 53637.000000, send time = 53637.795918.
RTPEngine: Packet sent at = 53638.000000.
On our server (XP) where it has to actually run later, it gives me this:
RTPEngine: Next send time = 53637.795918.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
.
.
.
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
RTPEngine: Time now = 53628.000000, send time = 53637.795918.
RTPEngine: Packet sent at = 53644.000000.
As you can see ... too late .
Any ideas?
Souldrift
modified on Friday, July 3, 2009 6:20 AM
|
|
|
|
|
Let me get my traditional admonition about Windows + real-time behaviour out of the way first - Windows is not anywhere near being a real-time OS, there's too much stuff going on, it has high interrupt latency etc etc. Ha, that's better.
Now - the one thing that may improve your situation is to increase the priority of your sending thread. Alternatively, you could use a different strategy - use a waitable timer[^], with a completion routine that sends the packet. Put the thread into an alertable wait state when you set the timer and the completion routine should get called by the timer.
The advantage of doing this is that the more your code is running, the more Windows will give a dynamic priority boost to other, similarly prioritised threads. If your code sleeps, that won't happen, and also, your system as a whole will be slightly more responsive.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for the idea. I tried it (very exitedly). But I´m running into the same problem.
My new code is:
int RTPEngine::SendRTPPacket( BYTE* data, int size )
{
if( data && size > 0 && m_pHeader )
{
m_pLogger->Out(Logger::DEBUG, "RTPEngine: Sending data package with size %d (excluding header).\n", size);
BYTE* packet = new BYTE[size+12];
BYTE* headerBytes = m_pHeader->GetInc();
for( int i = 0; i < 12; i++ )
{
packet[i] = headerBytes[i];
}
for( int i = 0; i < size; i++ )
{
packet[i+12] = data[i];
}
double now = 0.0;
if( m_dPacketSendTime != 0.0 )
{
now = ((double) clock() / CLK_TCK) * 1000;
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Time now = %f.\n", now );
double dueMS = m_dPacketSendTime-now;
if( dueMS > 0 )
{
HANDLE hTimer = 0;
LARGE_INTEGER liDueTime;
hTimer = ::CreateWaitableTimer(0, TRUE, L"WaitableTimer");
liDueTime.QuadPart = -((int)dueMS * 10000);
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, FALSE);
::WaitForSingleObject(hTimer, INFINITE);
}
}
now = ((double) clock() / CLK_TCK) * 1000;
int rc=sendto(m_oUDPSocket,(char*)packet,size+12,0,(SOCKADDR*)&m_oUDPAddress,sizeof(SOCKADDR_IN));
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Packet sent at = %f.\n", now );
m_dPacketSendTime = ((double) clock() / CLK_TCK) * 1000;
m_dPacketSendTime += (m_dPacketLengthMillis*(1.0 - m_dRTPOverlap));
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Next send time = %f.\n", m_dPacketSendTime );
return size;
}
else
return 0;
}
I´m at a loss ...
Souldrift
Edit:
Actually I just found that this doesn´t work as expected. The output is:
RTPEngine: Next send time = 3009.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 3000.
RTPEngine: Packet sent at = 3000.
RTPEngine: Next send time = 3009.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 3000.
RTPEngine: Packet sent at = 3000.
RTPEngine: Next send time = 3009.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 3000.
RTPEngine: Packet sent at = 3000.
It doesn´t wait at all ??
modified on Friday, July 3, 2009 7:34 AM
|
|
|
|
|
The documentation for WaitForSingleObject[^] says this:
To enter an alertable wait state, use the WaitForSingleObjectEx[^] function
As I said, you need to be in an alertable wait state for your APC to be called.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Unfortunately that changes nothing
|
|
|
|
|
I put together a wee program demonstrating waitable timer usage:
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
void ReportTime(const char* message, LONGLONG const& when)
{
std::cout << message << double(when)/10000.0 << std::endl;
}
VOID CALLBACK DoSendHere(__in_opt LPVOID lpArgToCompletionRoutine,
__in DWORD dwTimerLowValue,
__in DWORD dwTimerHighValue)
{
LARGE_INTEGER const& ftSleepStart = *(LARGE_INTEGER*)lpArgToCompletionRoutine;
LARGE_INTEGER liTimer;
liTimer.LowPart = dwTimerLowValue;
liTimer.HighPart = dwTimerHighValue;
ReportTime("DoSendHere::Timer slept for ", liTimer.QuadPart-ftSleepStart.QuadPart);
delete lpArgToCompletionRoutine;
}
int SendLoop()
{
LARGE_INTEGER ftStart;
GetSystemTimeAsFileTime((FILETIME*)&ftStart);
HANDLE hTimer = 0;
hTimer = ::CreateWaitableTimer(0, TRUE, L"WaitableTimer");
LARGE_INTEGER ftNow;
LARGE_INTEGER ftWaitTill;
GetSystemTimeAsFileTime((FILETIME*)&ftNow);
while(1)
{
ReportTime("SendLoop::Now = ", ftNow.QuadPart-ftStart.QuadPart);
ftWaitTill.QuadPart = ftNow.QuadPart + 5000000I64;
SetWaitableTimer(hTimer, &ftWaitTill, 0, &DoSendHere, new LARGE_INTEGER(ftNow), FALSE);
ftNow = ftWaitTill;
::SleepEx(INFINITE, TRUE);
}
}
int _tmain(int argc, _TCHAR* argv[])
{
SendLoop();
return 0;
}
This is intended to set a timer for 500ms in the future and sleep until the timer's triggered, at which point a) the completion routine is called, and b) the SleepEx call exits.
I get this output (on Windows XP SP 3):
SendLoop::Now = 0
DoSendHere::Timer slept for 499.978
SendLoop::Now = 500
DoSendHere::Timer slept for 499.955
SendLoop::Now = 1000
DoSendHere::Timer slept for 499.933
SendLoop::Now = 1500
DoSendHere::Timer slept for 499.91
SendLoop::Now = 2000
DoSendHere::Timer slept for 499.888
SendLoop::Now = 2500
DoSendHere::Timer slept for 499.866
SendLoop::Now = 3000
DoSendHere::Timer slept for 499.843
SendLoop::Now = 3500
DoSendHere::Timer slept for 499.821
SendLoop::Now = 4000
DoSendHere::Timer slept for 499.798
SendLoop::Now = 4500
DoSendHere::Timer slept for 499.776
SendLoop::Now = 5000
DoSendHere::Timer slept for 499.754
SendLoop::Now = 5500
DoSendHere::Timer slept for 499.731
SendLoop::Now = 6000
DoSendHere::Timer slept for 499.709
SendLoop::Now = 6500
DoSendHere::Timer slept for 499.686
SendLoop::Now = 7000
DoSendHere::Timer slept for 515.288
SendLoop::Now = 7500
DoSendHere::Timer slept for 499.642
You can see that the timer triggers approximately 40 microseconds before the due time. This is interrupted when the processor's busy (for example, when I rebuild the software), as shown by the sleep period of 515ms. This is because Windows will not interrupt an active thread when signalled - so your time could be delayed by as much as a time-slice quantum.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for that. I highly appreciate you getting into this so much.
I all but copied your code and it works on my machine. But as soon as I put it on our server machine, the ol´ troublemakers show up again. I set a sleep time of appx. 10ms and usually the thing sleeps the day away ... well, 15 ms .
The output in my case is
RTPEngine: Next send time = 12891106961478.547000.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 12891106961468.750000.
DoSendHere::Timer slept for 15.625000
RTPEngine: Packet sent at = 12891106961484.375000.
RTPEngine: Next send time = 12891106961494.172000.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 12891106961484.375000.
DoSendHere::Timer slept for 0.000000
RTPEngine: Packet sent at = 12891106961484.375000.
RTPEngine: Next send time = 12891106961494.172000.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 12891106961484.375000.
DoSendHere::Timer slept for 15.625000
RTPEngine: Packet sent at = 12891106961500.000000.
RTPEngine: Next send time = 12891106961509.797000.
JobManager: Job 0_0 processed packet with size 2048. Packets available: 67
RTPEngine: Preparing to send data bundle with size of 1520 bytes.
RTPEngine: Adding leftover (352 bytes).
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 12891106961500.000000.
DoSendHere::Timer slept for 15.625000
RTPEngine: Packet sent at = 12891106961515.625000.
RTPEngine: Next send time = 12891106961525.422000.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Time now = 12891106961515.625000.
DoSendHere::Timer slept for 15.625000
RTPEngine: Packet sent at = 12891106961531.250000.
What bugs me even more than that (as seen in the output) is that the Timer sometimes sleeps for 0 ms even though it should wait.
Looking into it ... might be something with threads and time-slices, after all.
Souldrift
|
|
|
|
|