|
Looking at the documentation for LOG4CXX_INFO [^], I wonder if you should use the char* as the second parameter, like:
char* aestr = ba.data();
log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("RMAT");
LOG4CXX_INFO(logger, aestr);
}
|
|
|
|
|
Thank you kindly for the suggestion, but oddly a missing [static] library on which log4cxx was dependent went missing.
Don't ask me why the Linker didn't complain but the debugger decided to throw a buffer overrun
A ghost from the past. Known to others as "Linda".
|
|
|
|
|
This is probably where the buffer overrun was detected, not where it actually occurred. In general it is not possible (or prohibitively expensive) to detect the actual corruption. Try using the Page Heap[^], although this often falls in the prohibitively expensive category. Remember to disable it when you're done!
WARNING: DO NOT ENABLE THE PAGE HEAP FOR ALL PROCESSES, JUST THE ONE YOU'RE DEBUGGING. YOU HAVE BEEN WARNED!
Steve
|
|
|
|
|
Hi,
Is it possible to create a view (In MFC MDI app)without document as follows?
CMultiDocTemplate* pDocTemplate = new CMultiDocTemplate(IDR_CheckTYPE,
NULL,
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CCheckView));
I mean, passing NULL for the document runtimeclass and use pDocTemplate->CreateNewFrame().
Thanks,
Prasanth
|
|
|
|
|
Why you do not want to use the CDocument?
I'd rather be phishing!
|
|
|
|
|
What happens when you try it?
|
|
|
|
|
Yes, I do it all the time.
- basically, the "View" will not be attached to the derived object class of (CDocument).
- the attached derived (CDocument) object is intended to update the View when the derived object changes.
|
|
|
|
|
|
Hi All,
Can anyone guide me to find the MS project kind of UI application developed in MFC or C#?
It will be kind enough if you can provide me the some useful Links as well
Thanks & Regards,
SAM
|
|
|
|
|
|
I'm doing a project about the Outlook plug-in synchronous address book.
Double-click on the list of email users to add to the recipient email box.
The second double-click on the same email address will lead to repeat.
Now want to read the recipient before double click on the box.But you can't read
C++ Code:
EnumChildWindows(hwndWriteMail, EnumChildProc, (LPARAM)EmailAddr.GetBuffer());
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam)
{
int id = -1;
id = ::GetDlgCtrlID(hWnd);
if (id == 0x00001003){
::SendMessage(hWnd, EM_REPLACESEL, NULL, (LPARAM)lParam);
}
return TRUE;
}
Use Windows SPy++ view within the recipient can get RichEdit editbox for the RichEdit normal character but outlook email address will be automatically after formatting is not available
How do I get RichEdit edit box content? thanks
None
|
|
|
|
|
Hi, in my program,I use a CStatic object to flash a string every 3-4 seconds.
But I found, sometimes the string is blinking.
How can I flash the string and don't have jitter phenomenon?
modified 15-Apr-14 10:54am.
|
|
|
|
|
Define flash and blink. In my book, they are synonymous.
Where are you setting the CStatic object's value at?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I want to show the string like the follow sequence:
0 - 4 Second: Display string
4 - 8 second: Display nothing,clear screen
8 - 12 second: Display string
12-16 second: Display nothing,clear screen
...
Now I found the string blinking during 0-4,8-12 seconds.
|
|
|
|
|
It looks your text flickers because you are repeadetly drawing the string. In the 0-4 (and 8-12) interval you have to draw the string just once. You could set a boolean variable the very first time you draw the string and then check it before drawing it again (of course you have to reset the boolean variable upon entering in the 'blank' interval).
Veni, vidi, vici.
|
|
|
|
|
|
You are welcome.
Veni, vidi, vici.
|
|
|
|
|
Windows 7, 64 bit, Visual Studio 2012, MFC, C++
Summary: The app starts a new thread and waits on multiple events from the main to do something. The wait specifies no timeout. At this point, the main has not created any events. Within the thread the case statement shows a timeout is always present. I tried resetting the time out event but get the error code invalid handle.
What did I do wrong to cause the timeout event and what must be changed to stop it.
Details: The following is phrases extracted from the thread code:
const BOOL WAIT_FOR_ANY_EVENT = FALSE;
const BOOL WAIT_FOR_ALL_EVENTS = TRUE;
const DWORD WAIT_TIMEOUT_VALUE = 5000;
const DWORD NO_TIMEOUT = 0;
...
event_detected = WaitForMultipleObjects(
EVENT_ARRAY_SIZE,
mp_common_data->event_array,
WAIT_FOR_ANY_EVENT,
NO_TIMEOUT );
...
switch( event_detected )
{
case WAIT_TIMEOUT:
{
mp_common_data->count_of_timeout_events ++;
BOOL reset_status = ResetEvent( (HANDLE ) WAIT_TIMEOUT );
if( reset_status == FALSE )
{
m_wsa_error = GetLastError();
}
...
break;
}
...
}
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
modified 13-Apr-14 19:58pm.
|
|
|
|
|
I don't see a problem with WaitForMultipleObjects()[^] returning WAIT_TIMEOUT in this case. The documentation states:
Quote: WAIT_TIMEOUT: The time-out interval elapsed and the conditions specified by the bWaitAll parameter are not satisfied. Even though you are specifying zero as your time-out interval, it is still an interval (sort of). Look at the documented return values and think about what other value could be returned in this case.
If your intention is to wait until your events actually signal, then consider using INFINITE instead of zero, but beware of the problems that might cause - you will be waiting until all events in your array are signaled.
BTW, are you sure you want to specify bWaitAll = TRUE ? Bear in mind, that this is AND logic, meaning all of your events must be signaled before WaitForMultipleObjects() returns a non-error result.
The ResetEvent()[^] returns FALSE because you are not passing a valid handle. You pass in a timeout value, but that is not how that function is used.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
I have the answer. Wait 0 in most places, all that I have used until now, means no wait period. In this case it means immediately time out. I should have read the documentation more carefully. Still, that is not a good option to have.
Argument 3 is wait for any event, not wait for all. This is still in the initial stages of testing, just getting the events right and not doing anything useful. (Then again, that test is quite useful.)
To help me in the future I changed my time out constants as follows:
const DWORD WAIT_TIMEOUT_05_SECONDS = 5000;
const DWORD WAIT_TIMEOUT_60_SECONDS = 60000;
const DWORD IMMEDIATE_TIMEOUT = 0;
Thank you for the re-direct.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
bkelly13 wrote: Argument 3 is wait for any event, not wait for all. My bad, I could have sworn you were passing in the constant defined as TRUE there.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
modified 16-Apr-14 4:03am.
|
|
|
|
|
Hi There,
I've spent a number of years away from C and C++ but recently decided to get back to it. I downloaded the latest VS2013 C++ and off I went.
My challenge is that I cannot get the DLL I need to use to link in. I've generated a .def file using Dumpbin and then used that to create a .LIB for the DLL. I've put the lib in the Additional Dependencies of the Linker properties and added the directory to VC++ directories. It is definitely reading the lib because if I name it wrong then I get a can't find the lib error.
I am still getting a LNK2019 unresolved externals message. I tried dumping the lib using dumpbin /EXPORTS and it has all the functions (though they are preceeded by _) I did even try using the _Functionname.. names in the code but still no luck.
It feels like in the 10-15 years in between C++ should have got a lot easier. I sort of expected to just drop the dll in the project and off it would go. Hey ho, anyone that can point me at what I'm doing wrong I would be grateful
Trevor
|
|
|
|
|
I assume you're using a header file to describe the functions that live in the DLL?
If so, try putting this around the function declarations:
extern "C"
{
}
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi Richard,
Thank you very much, I knew it would be something simple I just could not see it!
All linking okay now
Trevor
|
|
|
|
|
I'm new to C++ programming and also new to posting on forums. I'm sorry if I don't enter this correctly for my first post. I am trying to create a program that will display a predetermined shipping charge for 2 zip codes. Program should send error messages if the zip code entered is not 5 digits long, not all 5 numbers, or does not begin with 605 or 606. Below is the code I have written so far. Sentinel value of -1 should end the program. The messages seem to be correct when I enter test data but it keeps looping the same message repeatedly and I have to close the program to stop it. Can anyone tell me what I've done wrong?
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//function prototype
char verifyNumbers(string);
int main ()
{
//declare variables
string zip = " ";
char isAllNumbers = ' ';
const string invalid_length = "Invalid length";
const string not_all_numbers = "Not all numbers";
const string invalid_shipping = "Zip code is not valid for shipping charges";
//get input (zip code)
cout << "Enter 5 digit zip code (-1 to end): ";
getline(cin, zip);
//verify input
while (zip != "-1")
{
if (zip.length() == 5)
{
isAllNumbers = verifyNumbers(zip);
if (isAllNumbers == 'Y')
{
if (zip.find ("605", 0) == 0 || zip.find ("606", 0) == 0)
{
if (zip.find("605", 0) == 0)
{
cout << "Shipping is $25" << endl;
}
else
cout << "Shipping is $30" << endl;
//end if
}
else
cout << invalid_shipping << endl;
//end if
}
else
cout << not_all_numbers << endl << endl;
//end if
}
else
cout << invalid_length << endl << endl;
//end if
cout << "Enter 5 digit zip code (-1 to end): ";
getline(cin, zip);
} //end while
//calculate shipping charges
//display output
} //end of main function
//*****function definitions*****
char verifyNumbers(string zip) //determine if each character is a number
{
//declare variables
string currentChar = "";
int x = 0;
char isNumber = 'Y';
//determine if characters are all numbers
while (x < 5 && isNumber == 'Y')
{
currentChar = zip.substr(x, 1);
if (currentChar >= "0" && currentChar <= "9")
x += 1;
else
isNumber = 'N';
//end if
}//end while
return isNumber;
} //end of verifyNubmers function
I really appreciate any help I can get!
Thank you! Carla
-- modified 11-Apr-14 22:40pm.
|
|
|
|