15,608,404 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 Python questions
View Javascript questions
View C++ questions
View Java 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 11917640 Member (Top 92 by date)
11917640 Member
22-Feb-23 2:47am
View
And the last thing, I can think about. I would try to divide this algorithm to the high level (how to draw the screen, when I don't have enough memory to do this with one bitmap), and low level (dirty implementation details). Your render function seems to work on both levels, and looks [a bit] complicated.
11917640 Member
22-Feb-23 2:31am
View
So, how can you redraw the whole screen? Probably, by divining it by subrectangles, that you can draw at once. For each subrectangle, you need to draw background, then ask every control, that intersrcts with this subrectangle, to draw itself. Makes sense? Maybe, this way can produce better rendering algorithm?
11917640 Member
22-Feb-23 2:28am
View
Probably, you need the function like InvalidateRect, which invalidates some part of the screen, or the whole screen. During rendering, invalidated area must be redrawn, first background, then controls. Control needs to know, how to draw itself with some offset, probably including the situation, when some part of the control is out of destination bitmap.
11917640 Member
22-Feb-23 2:25am
View
Maybe you need to make one step back and think about the whole algorithm again? I understand, that you can render the screen using bitmaps, when bitmap size is less that screen size. Right? You also have some list of controls, hopefully, sorted by z-order. There is also screen background, that needs (or not?) be redrawn.
11917640 Member
8-Dec-22 3:54am
View
For rectangle ROI. Fast solution: using DrawFocusRect API. For full solution, see DrawCli MFC code sample.
11917640 Member
8-Dec-22 3:52am
View
What is "free ROI"? Non-rectangle?
11917640 Member
14-Nov-22 5:41am
View
From my last comment: Actually, FILTER_MESSAGE_HEADER is quite simple structure, so you can define lpMessageBuffer as ByRef FilterMessageHeader, and forget about manual marshalling tricks.
11917640 Member
14-Nov-22 3:16am
View
Use Marshal.StructureToPtr to fill unmanaged memory block before FilterGetMessage call (if necessary). Use Marshal.PtrToStructure to read data from unmamanged memory block after FilterGetMessage call. Actually, FILTER_MESSAGE_HEADER is quite simple structure, so you can define lpMessageBuffer as ByRef FilterMessageHeader, and forget about manual marshalling tricks.
11917640 Member
14-Nov-22 3:16am
View
Define lpMessageBuffer parameter as IntPtr. Create unmanaged memory block using Marshal.AllocHGlobal(Marshal.SizeOf<filtermessageheader>()). When finished, don't forget to release it using Marshal.FreeHGlobal.
11917640 Member
14-Nov-22 3:16am
View
Write PINvoke declaration of FILTER_MESSAGE_HEADER structure according to this page: https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/fltuserstructures/ns-fltuserstructures-_filter_message_header Public Structure FilterMessageHeader {...}
11917640 Member
14-Nov-22 1:15am
View
I don't see in your code anything about FILTER_MESSAGE_HEADER, see https://learn.microsoft.com/en-us/windows/win32/api/fltuser/nf-fltuser-filtergetmessage and https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/fltuserstructures/ns-fltuserstructures-_filter_message_header. Also, if you don't use overlapped IO, lpOverlapped may be declared as IntPtr and set to IntPtr.Zero.
11917640 Member
14-Nov-22 0:25am
View
ByRef messageBuffer As IntPtr - remove ByRef . FilterGetMessage requires pointer to buffer, and you pass pointer to pointer to buffer.
11917640 Member
14-Nov-22 0:21am
View
Deleted
Show declaration of native functions FilterConnectCommunicationPort, FilterGetMessage from fltlib.dll.
11917640 Member
7-Nov-22 6:44am
View
return (b & (~a));
11917640 Member
31-Oct-22 5:59am
View
Subscribe to SerialPort DataReceived event.
11917640 Member
27-Oct-22 7:12am
View
So, you have two timers set at the same time and with same period. Why do you need two timers and not one, that makes all actions in the desired order?
11917640 Member
28-Sep-22 1:53am
View
Languages vs Language.
11917640 Member
25-Jul-22 0:08am
View
Again, write client code first in C/C++. It is difficult to solve both the problems with driver communication and .NET interoperability at the same time.
11917640 Member
24-Jul-22 8:49am
View
I see at least one PInvoke problem: ByRef overlapped As IntPtr, should be without ByRef. I think you need to write first native client, having it working, translate it to VB. One problem at time.
11917640 Member
24-Jul-22 8:42am
View
Deleted
scanf("%c", &command);
11917640 Member
21-Jul-22 6:00am
View
In deriv2 function: int j,deg2,deg; deg2=deg-1; - deg is not initialized. Don't ignore compiler warnings.
11917640 Member
13-Jul-22 1:56am
View
Notepad++, main menu, Language - select required language.
11917640 Member
30-Jun-22 3:58am
View
Deleted
You have local variable NumberOfBytesWritten. You pass the pointer to it to the function WriteFile. WriteFile fills it with number of bytes written. That's all, nothing to clear. Your code is correct.
11917640 Member
23-Jun-22 4:27am
View
Deleted
DeviceParameters structure and its sub-structures are simple POD types, you don't need to use low-level Marshal memory management functions.
11917640 Member
23-Jun-22 4:24am
View
Deleted
BOOL SetDeviceParameters( DWORD DeviceID, DeviceParameters DeviceParam ) - DeviceParam is not pointer, so your C# declaration IntPtr DeviceParam is wrong. Create C# DeviceParameters structure (not class), define it as StructLayout(LayoutKind.Sequential), and pass it by value.
11917640 Member
22-Mar-22 9:24am
View
Deleted
If you are using SO_KEEPALIVE, read this article: https://holmeshe.me/network-essentials-setsockopt-SO_KEEPALIVE/ Is this what are you looking for?
11917640 Member
15-Feb-22 8:40am
View
StopWatch is not exactly C...
11917640 Member
27-Jan-22 3:37am
View
Deleted
Activity Activities[] = ... Why do you need this array if it is not used?
11917640 Member
6-Dec-21 8:59am
View
cppreference contains similar example: alignas(64) char cacheline[64]; Did you try to set alignas in the beginning?
11917640 Member
25-Nov-21 0:19am
View
Deleted
Articles - Browse topics - Desktop programming - ...
11917640 Member
11-Oct-21 4:59am
View
Impossible to say anything without code. However, using OnPaint looks a bit strange - CTreeCtrl is able to draw itself, just fill it with nodes.
11917640 Member
11-Oct-21 2:53am
View
Deleted
You can use ostringstream in C++ instead of StringBuilder. Use << operator which works like StringBuilder.append. Finally, use str() function to convert ostringstream to string.
11917640 Member
2-Sep-21 3:38am
View
Deleted
Take the whole desktop bitmap. Create top-most window which covers the desktop, with black background, and draw this bitmap on it by the way you need. Though, as mentioned in previous comments, the proper way to implement this is to write screen saver.
11917640 Member
1-Sep-21 10:17am
View
Deleted
Did you try casting? Topic topicType = static_cast<Topic>(record["topic"].asInt());
11917640 Member
22-Aug-21 10:17am
View
Deleted
You already have checkWin and board forward declarations before main function. Do the same with load and save.
11917640 Member
17-Aug-21 0:19am
View
Deleted
You ask boost to serialize vector of pointers: check. When deserialized, these pointers point to nowhere. If you want to have simple serialization code, replace it with vector of instances.
11917640 Member
6-Jul-21 8:00am
View
Publisher is TCP server, subscriber is client. Subscriber doesn't bind to the port.
11917640 Member
6-Jul-21 8:00am
View
Deleted
Publisher is TCP server, subscriber is client. Subscriber doesn't bind to the port.
11917640 Member
6-Jul-21 4:46am
View
For clarity: publisher address tcp://*:5555 means: all available NICs (including localhost), publisher is bound to port 5555. Subscriber address tcp://localhost:5555 means: connect to localhost, port 5555.
11917640 Member
5-Jul-21 6:57am
View
Do you mean: on the same computer? Try address tcp://*:5555 for publisher and tcp://localhost:5555 for subscriber.
11917640 Member
30-May-21 9:39am
View
Deleted
https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Reference_counting
11917640 Member
19-May-21 8:51am
View
Deleted
What happens if you run the program as Administrator (even if you are in Administrator account)?
11917640 Member
18-May-21 4:10am
View
Deleted
Get main function here: https://holowczak.com/getting-started-with-windows-forms-using-visual-c-tutorial/2/ and add it to any .cpp file in the project. Replace Form1 with mainWindow, according to your class name.
11917640 Member
2-May-21 0:23am
View
Deleted
This is just Dll with native interface, which internally uses .NET in methods implementation. Do you know, how to make native Dll?
11917640 Member
22-Apr-21 0:51am
View
Deleted
All this code is from MFC, which is supposed to work, if used correctly. What is the project code that causes the crash? Try to make the same action in new MFC project, or find the sample which does similar action, and compare the code.
11917640 Member
18-Mar-21 4:36am
View
Global variable is defined as bstNode_t*. Function is defined as search(bstNode_t* root) This function can change the data pointed by root parameter (such as int data), but not the pointer itself. To change the pointer, function parameter must be defined as bstNode_t** You may be confused also by the same parameter and global variable name. To understand this code better, rename root parameter to something else.
11917640 Member
2-Feb-21 9:49am
View
myarray in your code is jagged array. See the difference here: https://docs.microsoft.com/en-us/cpp/dotnet/how-to-use-arrays-in-cpp-cli?view=msvc-160 multi-dimension managed array vs jagged array.
11917640 Member
2-Feb-21 9:36am
View
You need to pin pointer for every line.
11917640 Member
2-Feb-21 4:52am
View
Deleted
The answer is probably in BST class. If it has operator[] overloaded, second[i][j] calls it. If not, probably the map second member is array of arrays (or 2D array) of BST instances, and second[i][j] dereferences required BST instance in this array.
11917640 Member
15-Nov-20 6:40am
View
Run portmon program https://docs.microsoft.com/en-us/sysinternals/downloads/portmon and compare behavior of working and non-working programs.
11917640 Member
14-Jul-20 9:39am
View
Deleted
BTW, what is the point of loading MFC Dll with LoadLibrary? Usually LoadLibrary is applied to Dll having plain extern C functions. Looks like the best solution for this case is to run away from this problem and use normal non-MFC Dll.
11917640 Member
14-Jul-20 9:36am
View
Deleted
You can use theApp instead of AfxGetApp. Make search for AFX_MANAGE_STATE, if you want real solution. This is not memory corruption (unless you have some really bad Dll initialization code), this is some MFC state management problem.
11917640 Member
6-Jul-20 8:07am
View
Deleted
NotifyHandlerXP is never called.
11917640 Member
18-Dec-19 9:49am
View
Deleted
Well, "OpenGL C++/CLI" Google search gives several options, this one seems to be interesting: https://www.codeproject.com/Articles/16051/Creating-an-OpenGL-view-on-a-Windows-Form
11917640 Member
17-Dec-19 1:04am
View
GLUT is simple lightweight GUI framework for using (and mostly learning) OpenGL. If you want to use OpenGL in UI program (Windows API, C++/CLI, MFC or any other UI toolkit), use OpenGL directly without GLUT.
11917640 Member
4-Dec-19 10:05am
View
You can use Microsoft XmlLite SDK: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms752861(v=vs.85) IXMlReader::GetLineNumber is the feature you need: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms752834%28v%3dvs.85%29 However, XmlLite is relatively low-level SDK, and parsing XML document is not easy. You cannot load the whole document at once, and need to build the parsing logic in the program.
11917640 Member
27-Nov-19 10:48am
View
Try DBT_DEVICEREMOVECOMPLETE.
11917640 Member
29-Aug-19 8:25am
View
Deleted
See also: https://software.intel.com/en-us/articles/enable-10bpp (Intel® Media SDK) and https://www.amd.com/system/files/documents/10-bit-video-output.pdf (AMD’s 10-bit Video Output Technology).
11917640 Member
29-Aug-19 8:23am
View
Deleted
Do you have some specific problems with Nvida examples? Generally, you need to use OpenGL or Direct3D. And you need to have graphic card and monitor with 10 bit support.
11917640 Member
13-Aug-19 3:43am
View
Deleted
%6 is 2^6 = /64. Just another display format. You can see such notation, for example, typing ipconfig in the command prompt. BTW, how this question is related to programming?
11917640 Member
11-Aug-19 5:32am
View
The only reason I can see is incorrect handle value passed to CloseHandle. In such case, CloseHandle result is undefined.
11917640 Member
16-Apr-19 1:04am
View
You can change the /SUBSYSTEM parameter from Windows to Console (if this causes linker error, change also /ENTRY parameter). Or just use OutputDebugString + DebugView https://docs.microsoft.com/en-us/sysinternals/downloads/debugview
11917640 Member
2-Apr-19 10:02am
View
GetParameters function has DevParam* parameter. ref IntPtr in C# means that you pass pointer to pointer (DevParam**). It doesn't matter what return value you get now, all this is undefined behavior unless you fix all errors in the code.
11917640 Member
2-Apr-19 9:51am
View
There are no "small" errors in PInvoke. Every incorrect definition means undefined behavior.
11917640 Member
2-Apr-19 9:49am
View
In the second call ref IntPtr dParam should be IntPtr dParam. So, many small errors in the code, check everything carefully, especially C# - C++ - WinAPI types match.
11917640 Member
2-Apr-19 9:30am
View
Deleted
All Windows API display solutions are restricted to 8 bpp. There are two technologies that allow to make true 10 bpp display: Direct3D and OpenGL. This also requires 10 bpp support for display adapter + 10 bpp monitor. Both are quite expensive. If you want to implement this, you have a long way to go, Direct3D programming is a bit painful...
11917640 Member
2-Apr-19 9:25am
View
C# bool is not equal to WinAPI BOOL. C# char is not equal to C++ char. Check all types in PInvoke C# definitions. Check also, whether GetParameters function works properly when called from C++.
11917640 Member
1-Apr-19 10:23am
View
If you are using Qt Creator, it has "C++ Library" item in the File - New File or Project dialog.
11917640 Member
24-Mar-19 2:01am
View
Are you trying to use memory-mapped file just to send commands to the driver? Standard way to do this is DeviceIoControl.
11917640 Member
20-Mar-19 2:33am
View
If it works under debugger, the difference is probably in the current directory.
11917640 Member
20-Mar-19 2:32am
View
https://docs.microsoft.com/en-us/windows/desktop/Dlls/dynamic-link-library-search-order Dynamic-Link Library Search Order, see Standard Search Order for Desktop Applications.
1. The directory from which the application loaded (exe directory). 2. The system directory. 3. The Windows directory. 4. The current directory. 5. PATH
11917640 Member
17-Mar-19 2:01am
View
Device doesn't need to use broadcast, it can use sendto having the sender IP.
11917640 Member
12-Mar-19 10:35am
View
Deleted
Texas Instruments "Finder" utility which comes with one of their SDK contains C++ code that works by such way: enumerate all adapters, bind socket to every adapter, send broadcast messages. Unfortunately, I cannot send you the code, try to find it yourself. FYI, the same can be done using C#, for example: https://stackoverflow.com/questions/1096142/broadcasting-udp-message-to-all-the-available-network-cards
11917640 Member
12-Mar-19 2:58am
View
You need to bind UDP socket to the adapter IP address. Using GetIpAddrTable function you can enumerate all adapters and get their addresses.
11917640 Member
26-Feb-19 5:10am
View
Deleted
Probably steady (monotonic) clock is what are you looking for: https://en.cppreference.com/w/cpp/chrono/steady_clock
11917640 Member
3-Sep-18 2:37am
View
Call SetWindowRgn before BitBlt.
11917640 Member
2-Sep-18 4:09am
View
Deleted
Try to set min and max x to the same value in MINMAXINFO.
11917640 Member
2-Sep-18 1:38am
View
Deleted
Try to handle WM_GETMINMAXINFO and set minimal and maximal width to the same value.
11917640 Member
13-Aug-18 7:39am
View
Deleted
The problem is the current directory. If current directory is not where .ico file is placed, your code fails. If .ico file is always in the same directory as .exe, get full .exe name, extract directory from it and make full .ico file name, including this directory.
11917640 Member
13-Aug-18 2:58am
View
When program is executed from Visual Studio, current directory is project directory, and not bin/debug. Place .ico file to the project directory, and copy it to bin/debug in post-build event.
11917640 Member
26-Jul-18 2:53am
View
Is this your real code? vector<mat> imgs; and Mat img = ... Looks like different types. Show your actual code, and exact error message.
11917640 Member
22-Jul-18 5:55am
View
The reason is probably in new window WndProc function, registered with globals->window_class_name.
11917640 Member
19-Jul-18 4:13am
View
Deleted
Return value of the program goes to %ERRORLEVEL% environment variable and can be tested in a batch file, look here for example: https://stackoverflow.com/questions/6812484/batch-file-test-error-level By returning 4556 you signal to a caller that something was wrong. Usually %ERRORLEVEL% is tested for 0 and this value means success.
11917640 Member
17-Jul-18 7:48am
View
Posted.
11917640 Member
17-Jul-18 7:48am
View
Deleted
Posted.
11917640 Member
17-Jul-18 6:57am
View
Yes, it works in this case. After closing the socket accept should unblock and fail.
11917640 Member
17-Jul-18 6:56am
View
Deleted
Yes, it works in this case. After closing the socket accept should unblock and fail.
11917640 Member
17-Jul-18 3:00am
View
You need to close server_socket from another thread, in this case accept function returns immediately.
11917640 Member
17-Jul-18 2:58am
View
Delay of stop does not work - this means, something is wrong in TON_2 function. You need to provide more information.
11917640 Member
24-Jun-18 4:44am
View
mktime was the function I was looking for. It allows to return from human-readable timestamp back to computer time. Thanks for this hint.
11917640 Member
21-Jun-18 8:09am
View
Exactly, timestamp_to_timepoint is my real problem.
11917640 Member
21-Jun-18 7:59am
View
Deleted
Thanks, I updated my answer by replacing timestamp by time_point. This is quite enough for my purpose.
Show More