|
Why are you mapping the OnPaint?
See the MFC code of CView
void CView::OnPaint()
{
CPaintDC dc(this);
OnPrepareDC(&dc);
OnDraw(&dc);
}
It is calling the OnDraw. So you should not map OnPaint.
|
|
|
|
|
It's risky to call Invalidate () inside an OnDraw () or OnPaint () handler because it can potentially cause an infinite loop. Call Invalidate () right after the change to your data that you want to appear on the screen.
|
|
|
|
|
Hi all,
I want to open a connection with portable device connected to my pc for this i am using COM and a interface called IPortableDeviceManager.
To get devices i am using GetDevice function from this interface but i am
not getting how to pass parameters to this function
http://msdn.microsoft.com/en-us/library/ms739556(VS.85).aspx[^]
Can anybody please help me in this...
Thanks in advance
|
|
|
|
|
I have a wstring str which has data like
This is an apple
This is a Bat
This is a Cat
And i try to write the str into file using
FILE* outfile;
fputws(str.c_str(),outfile);
When i saw the ouput file it shows:
This is a Bat
This is a Cat
Can anybody help me out?????????????
|
|
|
|
|
Can you show how are you using wstring, how is str filled?
-Saurabh
|
|
|
|
|
str = L"This is an aple";
str+=L"\n";
str+=L"This is a bat";
str+=L"\n";
str+=L"This is a cat";
str+=L"\n";
fputws((wchar_t*)str.c_str(), outFile) ;
Did u get it or i need to be more clear.
|
|
|
|
|
I just tried this using VS 2008 and it is working fine. I am not sure what is the problem, is str used at some other place.
-Saurabh
|
|
|
|
|
Your code works fine with VS6.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
Id like to be able to intercept the output of some of the basic
windows drawing functions and record it somewhere. In particular drawtext.
Ive read that this can be achived by CBT hooking.
Despite reading several articals including the ones on this site im totally confused.
In my mind I image the process should work like this ...
I write a function call mydrawtext which takes in the same parameters as drawtext.
Writes the incomming info to a file and then calles the real drawtext.
I store it in mydrawtext.dll file and then compile it into a mydrawtext.lib
Next ...
I write a small .exe which when exectued figues out where the real drawtext function lives in memory
places a copy of mydrawtext.lib into the same address space
and then writes a few intructions to the location of the real drawtext fuction so that all calls to it are diverted to mydrawtext.
All the examples ive seen are totally confusing. Injecting insructions are inside the .dll. I cant work out whats going on ?
What would be really great is dead simple abc example of something like how to capture the input/output of the windows drawtext function.
Thanks,
Mark.
|
|
|
|
|
Hi Experts,
How can I create a entry for spacific file on right click in context menu of windows. Like if we create entry for all files, we create entry under
"*\\shellex\\ContextMenuHandlers\\OurKey" but what to do only for .txt file or .pst file?
|
|
|
|
|
|
i have a simple dialog project with a button and multiline edit control.
button click runs a worker thread which updates edit control data.
and i have also mapped the ON_WM_CTLCOLOR() to change colors of controls
and dialog.
if i run the thread 2-3 times my program crashes.but if i comment all
my coloring code from ON_WM_CTLCOLOR() it runs fine without any problem..
|
|
|
|
|
You should not update UI from workerthread.
Regards,
Sandip.
|
|
|
|
|
Hi,
I'm trying to create a manifest file in order to set the setting for UAC in Vista.
I already refer to msdn document. If I want to develop codes that need to be run in Vista and XP, I need to use the notes for-Building and Embedding a Manisfest with Microsoft Visual Studio 2005 for Windows Xp and Windows Vista Applications.
This is my manifest file.
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">
<ms_asmv2:trustinfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedprivileges>
<ms_asmv2:requestedexecutionlevel level="asInvoker">
But when I run, I got this error message:
general error c1010070:failed to load and parse the manifest.
FYI, I already go to Project Properties-Linker-Generate Manifest - NO.
Beside that, I also change at Project Properties-Manifest Tool-Input and Output-Additional Manifest File (i type the manifest file name).
Any ideas about this?
Thanks
|
|
|
|
|
Any help here?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I need to get notification when ever a Db exception is occuring in my application.
Is there a way to hook the DBException when it occus anywhere in the application?
Thanks
|
|
|
|
|
See if SetUnhandledExceptionFilter() helps
-Suhredayan
|
|
|
|
|
My program is only 3XX KBytes size.
It start very fast (1 to 2sec) in XP, but very slow (about 13sec) in Vista. What's problem? How to make it faster?
Please help!!
|
|
|
|
|
LaHaHa wrote: What's problem?
At this point, it could be most anything. Do all of your programs behave in this fashion? Are the slow ones connecting to a database or a remote machine? Could it be a security issue?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
How to solve it if it is the security issue?
Please help!
|
|
|
|
|
#define rand01 (0.9999999*double(rand())/RAND_MAX)
....
used later in the line
r = int(floor(N*rand01));
N is an integer with a value of 1000...
what does rand01 produce?
please help
many thanks
Give me strength, give me caffeine
|
|
|
|
|
a random number between 0.0 and 0.9999999
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
cool thanks for that...any idea of how to get that functionality into java?
thanks again
Give me strength, give me caffeine
|
|
|
|
|
I'm not sure what 'RAND_MAX' is, but other than that, the conversion produced by C++ to Java Converter follows (including a helper class that the converter outputs to help simulate C++ random number functionality in Java):
import java.util.*;
//C++ TO JAVA CONVERTER NOTE: The following #define macro was replaced in-line:
//#define rand01 (0.9999999*double(rand())/RAND_MAX)
private void test()
{
r = (int)(Math.floor(N*(0.9999999 *(double)(RandomNumbers.nextNumber())/RAND_MAX)));
}
//----------------------------------------------------------------------------------------
// Copyright © 2006 - 2008 Tangible Software Solutions Inc.
//
// This class provides the ability to simulate the behavior of the C/C++ functions for
// generating random numbers.
// 'rand' converts to the parameterless overload of NextNumber
// 'random' converts to the single-parameter overload of NextNumber
// 'randomize' converts to the parameterless overload of Seed
// 'srand' converts to the single-parameter overload of Seed
//----------------------------------------------------------------------------------------
final class RandomNumbers
{
private static Random r;
static int nextNumber()
{
if (r == null)
Seed();
return r.nextInt();
}
static int nextNumber(int ceiling)
{
if (r == null)
Seed();
return r.nextInt(ceiling);
}
static void seed()
{
r = new Random();
}
static void seed(int seed)
{
r = new Random(seed);
}
}
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
I have been assigned the task of updating a Visual C++ 6 software package to Visual C++ 2008. VS2008 did a bang up job during the conversion, leaving but a couple of dozen items to repair my self. One in particular has me against the wall.
Here is the reported error;
error C2678: binary '||' : no operator found which takes a left-hand operand of type '_bstr_t' (or there is no acceptable conversion)
The line it refers to is;
ASSERT(m_bstrDataSource);
Here is the ASSERT definition in AFX.H;
#define ASSERT(f) DEBUG_ONLY((void) ((f) || !::AfxAssertFailedLine(THIS_FILE, __LINE__) || (AfxDebugBreak(), 0)))
I would greatly appreciate some guidance.
|
|
|
|