16,015,594 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Ajay Vijayvargiya (Top 46 by date)
Ajay Vijayvargiya
8-Dec-14 2:00am
View
Reason for my vote of 1 \n No detail
Ajay Vijayvargiya
4-Jan-12 1:20am
View
Becauase the OP doesn't know only 'new' will call the constructor, and 'malloc' won't call it. And therefore `std::map` doesnt get initialized, and hence the crash.
Ajay Vijayvargiya
5-May-11 22:57pm
View
Well, that simply means the EXE should have .LIB file with it, OR the DLL would load the function dynamically using GetProcAddress. I would prefer a callback function, which would be imported from DLL, and EXE would call that function, passing the address (name) of the function in EXE.
Ajay Vijayvargiya
2-May-11 10:13am
View
I agree with you Stefan. But when asked "platform dependent language", obvious answer would be C/C++, and when asked "PI language", Java would come out. A Java compiler produces byte-code, and therefore it can be executed on compliant JVM without any changes - the same binary can be shipped to multiple platforms. But that's not possible with C++ - it is native binary. And that's the reason languages are categorized.
Ajay Vijayvargiya
2-May-11 8:17am
View
Please control your emotions and specially you Language. I am not a Java guy, but a hardcore C++ guy. Do check the profile of before making such kind of abusive statement.
Ajay Vijayvargiya
2-May-11 3:39am
View
My statement implied that Java is PI, not C++! C++ is DEPENDENT on platform. A binary generated using X compiler on Y platform, may not run on Z platform.
Ajay Vijayvargiya
2-May-11 3:36am
View
Looks like basic pointer level misunderstanding! :)
Edit: Not to answer, but to Brain!
Ajay Vijayvargiya
2-May-11 0:27am
View
Platform Independent? Then what is Java?
Ajay Vijayvargiya
2-May-11 0:14am
View
HOW are you calling the function? What exact parameters?
Ajay Vijayvargiya
2-May-11 0:13am
View
Start command prompt (cmd.exe), and run from there. See any error you might see on console.
And I am confused: You need access or you dont need full-access (i.e. you require Admin, or Non-Admin) ?
Ajay Vijayvargiya
30-Apr-11 3:09am
View
Same thing I said buddy, all numbers are stored in binary. So, you cannot say int is stored as base-2, and double is stored as base-10. Both are stored as sequence of bits (and therefore we have datattype-sizes). May be my statement was somewhat elusive...
Ajay Vijayvargiya
30-Apr-11 2:48am
View
It has nothing do with base of number. Integer numbers are stored as actual values, real numbers are stored as formula (mantissa, exponent). See IEEE for the explanation. Therefore, when you retrieve the float/double number, it is CALCULATED, and therefore may be bit imprecise.
Ajay Vijayvargiya
2-Feb-11 21:57pm
View
Deleted
Now what Polymorphism has to do with this?
Ajay Vijayvargiya
2-Feb-11 1:17am
View
Deleted
Dare to mention the uselessness?
Ajay Vijayvargiya
24-Jan-11 22:15pm
View
Deleted
I don't use gotos either. My point was "how to avoid goto, if used"
Ajay Vijayvargiya
17-Jan-11 9:09am
View
Direct answer: No. No exception happens on unbalanced ECS, LCS.
A buffer overrun can cause practically anything, and a CS corruption can easily be one of them.
Ajay Vijayvargiya
17-Jan-11 1:34am
View
"Also, please do me a favour: in case you figure out what's going on, share your experience."
What else do I need to mention? I cannot share the full source code, nor anything about the "product".
Ajay Vijayvargiya
17-Jan-11 1:31am
View
Windows Server 2008 R2, x64.
Yes, the code is artificial reproduction of the exception. It may not occur on other platforms; as I have seen in WS2003 it doesn't occur.
See, I am not very much concerned about exact reason of exception, but I wanted if there is possibility to have exception when CS object is directly modified. In my original case, An application has crashed, and crash dump analysis as well as application event shows 0xC0000264.
I coded above code to make sure it is not because of unbalanced Enter/Leave, but because of CS corruption - and that's it! :)
Ajay Vijayvargiya
16-Jan-11 9:33am
View
I saw that article, and this exception (as author mentions) may occur when SRW functions.
Ajay Vijayvargiya
16-Jan-11 9:31am
View
Let me make it more simple. A CRITICAL_SECTION object is under a struct/class, and that structure is being accessed from somewhere and there is possibility that some buffer overflow may corrupt one of more variables of CRITICAL_SECTION object. A mis-balanced Enter/Leave will not cause this exception.
Ajay Vijayvargiya
15-Jan-11 11:32am
View
Please don't edit title: "NEED" is correct
Ajay Vijayvargiya
15-Jan-11 11:31am
View
Just edited! :)
BTW, I did not say about "waiting" but about timeout specification while waiting (which I did not know!)
Ajay Vijayvargiya
15-Jan-11 11:20am
View
Timeout with critical-section??
EDIT: I read about timeout registry settings, and yes it is possible to set timeout. I did not know this. Thanks!
But again, this is not relevant to problem in hand. There is critical section in some structure, and that structure is probably being modified, causing the internal state of CRITICAL_SECTION to get modified. And this results in said exception when LeaveCriticalSection is called.
Ajay Vijayvargiya
15-Jan-11 11:18am
View
I am afraid to say that this doesn't add anything to the problem in hand. All I wanted to raise exception on LeaveCriticalSection. If you see my profile, you can find I know all about multithreading stuff.
Ajay Vijayvargiya
29-Oct-10 14:02pm
View
It doesn't shows up, or it doesn't allow you to type ?
Ajay Vijayvargiya
28-Oct-10 11:35am
View
GetModuleFileName, to get current directory? I think you mean GetCurrentDirectory.
Ajay Vijayvargiya
28-Oct-10 4:41am
View
Deleted
Depends. Even I haven't used this trick. Just shared it.
And if you say is it bad design, what about 'partial' keyword on C# ?
Ajay Vijayvargiya
23-Oct-10 15:05pm
View
Deleted
And seriously, from my perspertive, streaming, buffering and flushing is bad bad design for a message box. Come on man, you don't collect data for a messsage box from multiple sources, wait for new messages/events to come, and then "flush" the message box.
Ajay Vijayvargiya
23-Oct-10 14:59pm
View
Deleted
I just read the added stuff. My point was *just* to avoid formatting calls, if any, and use the MessageBoxFormatted directly, and nothing else. In MFC, CString is there, the + operators are there, even the stringstream (don't know exact classname) is there where << operator may be used for any datatype (where CString wouldn't work). Why do you need this extra stuff just for a messagebox??
For readers, this is truly an alternate, but not for me! :)
Ajay Vijayvargiya
21-Oct-10 8:56am
View
Deleted
Quite good, and powerful. But not adaptable easily. My point was to omit the variable declaration, formatting (either wise), and then call function to display message box. Your solution requires variable declaration. And I don't see how << can be used in cascaded manner. Would it display multiple message box or one? Now, Again, you need to add one more line!
I regularly use templates and advancements in compiler and tools. But I found this extraneous!
Ajay Vijayvargiya
19-Oct-10 7:05am
View
Deleted
Class is good, no issues regardning that. But it is not flexible enough to "inline" where you just need to create a thread. Since this is just a tip/trick, I did not expand it - I have more ideas about this, that would allow to create threads even within classes, as sumple as calling a function.
Ajay Vijayvargiya
19-Oct-10 5:51am
View
Deleted
And how do you use it?
I assume it is more complex than CreateThread, AfxBeginThread.
Ajay Vijayvargiya
18-Oct-10 23:00pm
View
Deleted
Even I dont agree. But this point it re-usability, and I think you missed that point.Instead of writing a code that meets the function prototype (arguments, return type, calling convention) of the thread-creation function, you can carefully write a thread delegator once, and then just use that delegator on most basic function. Don't compare it with one thread in a system, but dozen threads (with different thread-procs) in a system. Even by reading all this, you may not agree, but you will understand it sooner or later! :)
Ajay Vijayvargiya
14-Oct-10 14:26pm
View
Deleted
Cannot accept it as Alternate Solution, it just your feedback!
Ajay Vijayvargiya
14-Oct-10 14:25pm
View
Deleted
Absolutely. I had finalized with that thing. But I see this Tip/Trick became long, so I froze!
Ajay Vijayvargiya
14-Oct-10 2:30am
View
Deleted
My mistake. Did not read it properly. Yes, you said it right, we cannot determine this way!
Ajay Vijayvargiya
14-Oct-10 2:28am
View
Deleted
if(sizeof(void*) == 4 )
// 32 bit
else(sizeof(void*) == 8 )
This is NOT correct way to determine if OS is 32-bit or 64-bit. It is the bitness of your application, which is defined at compile time!
Ajay Vijayvargiya
27-Sep-10 22:58pm
View
char buffer[10]; // Global
...
// thread 1.
int n1 = atoi(buffer);
// thread 2
int n2 = atoi(buffer);
Isn't it thread-unsafe? This is the whole point. Unless you guard the function or the object yourself, it is unsafe!
Ajay Vijayvargiya
27-Sep-10 15:07pm
View
Program code, user forms, database, sorting searching, multithreading, printing.. you need everything to implement - my sixth sense says. Come on, please explain more about it.
Ajay Vijayvargiya
27-Sep-10 14:58pm
View
Funny answer: int n = 2^999; is valid!
Serious question: Why do you need that?
Ajay Vijayvargiya
27-Sep-10 14:53pm
View
Your question is well answered, this is about disabling C++0x, and other VC10 stuff.
Just change the compiler toolset (in project properties), from v100 to v90. You *must* have VS 2008 installed.
Ajay Vijayvargiya
27-Sep-10 14:39pm
View
See if EM_SETCUEBANNER message-code is available for your code. This is due to macros described by Sauro above. Ensure you defined those macros BEFORE anything else in your code/project.
Ajay Vijayvargiya
25-Sep-10 4:40am
View
Deleted
Reason for my vote of 1
This is not alternate. You should have commented, not given it as alternate
Ajay Vijayvargiya
22-Sep-10 10:19am
View
Deleted
I believe they are not common among Windows and/or MFC programmers. Thus, I have not added it. Also, putting them would require this Tip/Trick to be longer (Article would fit). I also believe that anyone using BSTR/ComBSTR knows well about ANSI/Unicode stuff.
Ajay Vijayvargiya
19-Sep-10 16:56pm
View
Deleted
If using C++: IntPtr is not available in C++. Rather sizeof(int) does the same.
Nonsense, int is always 4-bytes, on 32-bit AND on 64-bit. Windows implements LLP64 model for 64-bit architecture.
Ajay Vijayvargiya
19-Sep-10 16:52pm
View
Deleted
Reason for my vote of 1
This alternate is absurd and should be removed immediately. The 32-bit native image generated always say 32, and 64-bit will always say 64. The sizeof is NOT runtime defined, it is ALWAYS compile time!
Show More