15,896,557 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 Python 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 KulaGGin (Top 6 by date)
KulaGGin
27-Nov-23 9:41am
View
"Reading a file that is being edited at the same time sounds like a really bad idea."
It's not a bad idea. A perfectly valid use case: encrypting file in-place with AES using streams, so that you can encrypt big files and it's all good and well.
"I'm afraid you could get unexpected results and impossible-to-find bugs..."
No. That's wrong. You just write your code against the Stream, StreamReader and StreamWriter classes and you do TDD, so everything is tested, and then you also apply good software engineering practices, such as Clean Code, Clean Architecture, DDD, SOLID principles, GRASP principles, etc. Then you don't get unexpected results and bugs: everything is well-engineered and tested, and everything just works.
KulaGGin
24-Jul-23 11:42am
View
Ok, but the answer is still wrong: GetWindowThreadProcessId still doesn't get window handle from a process ID. GetWindowThreadProcessId gets a process ID using the window handle you provide to it. And what you provide to it is hCurWnd = 0. So it doesn't do anything, it'll just put 0 in your curProcessID. This function is still completely broken. See the docs for the function yourself: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowthreadprocessid
Why did you do this? You asked the question, then wrote a completely broken answer without testing it or even making sense whatsoever: the docs clearly tell us what the function does, then accepted it as the solution. Karma farming?
KulaGGin
23-Jul-23 4:54am
View
Deleted
Your answer doesn't have a solution. The function is absolutely broken and doesn't even attempt at doing what the question asks. This answer should be deleted.
KulaGGin
23-Jul-23 4:42am
View
"which will cause it to enumerate all the windows from all the processes"
It won't do that. GetWindowThreadProcessId doesn't locate handle of a window by process id, the function takes in a valid window handle and the identifier of the process that created the window.
Also, he tries to get a window using FindWindowEx and passes a null hCurWnd, which will return him null.
Then the do-while will run once and exit. The GetWindowThreadProcessId won't return anything meaningful, will probably leave dwProcessID at 0, then it will push null hCurWnd to the vector, print, exit the loop and then the function.
There's like everything wrong with that function, feels like it was a troll answer or something.
KulaGGin
23-Jul-23 4:38am
View
This is absolutely a wrong answer. First of all, you're redefining your dwProcessID argument with the local variable dwProcessID that you define later and overwrite it with 0, so your local variable hides the argument and the argument isn't even used anywhere. So it's already broken. But even if you remove your local variable and use the argument, the function GetWindowThreadProcessId doesn't locate handle of a window by process id, the function takes in a valid window handle and the identifier of the process that created the window.
This function is completely broken and doesn't answer the question.
KulaGGin
8-Jul-20 15:22pm
View
I am after having generic functions that work with different types, inheritance, polymorphism and being able to override my generic functions in derived classes. C++, unlike C#, can't do it using normal tools like virtual methods, function templates, abstract classes, interfaces and inheritance. Because you can't mix virtual with templates.
What I was looking for is CRTP and static polymorphism. See my accepted solution with working examples in C# and C++ that do just what I'm after.
Show More