Click here to Skip to main content
15,400,295 members

Comments by Shao Voon Wong (Top 163 by date)

Shao Voon Wong 17-Jul-22 0:47am View
You can read my article on how to call C/C++ from Javascript or vice versa.
Shao Voon Wong 28-Jun-22 3:17am View
Put ampersand on the second last parameter.
bErrGHJ = WriteFile(hDFile, LpAll, Bytes_that_need_To_Write - bytes_which_have_written_already, &bytes_which_have_written_already, NULL);
Shao Voon Wong 6-May-22 23:02pm View
Yes, because the pixel color is on your graphics card, not DC when using hardware acceleration.
Shao Voon Wong 5-May-22 0:10am View
Maybe you can try to capture the image using DirectX? You need to modify the code in the article below to capture the window content instead of a screen. I cannot help you with this because it is too complicated in a post.
Shao Voon Wong 4-May-22 23:51pm View
Perhaps your Chrome browser is using hardware acceleration for graphics rendering? This means it is not using DC for rendering but DirectX.
Shao Voon Wong 22-Apr-22 3:37am View
5, concise explanation!
Shao Voon Wong 22-Apr-22 1:00am View
fwrite() writes binary bytes which are not human-readable bytes. If you want human-readable content you have to call fprintf() on every member of your struct. Please remember to call fflush() to flush the unwritten contents from the buffer to the file before calling fclose().
Shao Voon Wong 19-Apr-22 21:03pm View
Brilliant! Good work at spotting the bug! Got my 5!
Shao Voon Wong 15-Apr-22 1:02am View
Got my 5!

It would be best if you provide the full source code for your last snippet, especially on how to allocate memory to the pointer to pointer (nbuf) and call GetComputerNameExA() again.
Shao Voon Wong 13-Apr-22 1:48am View
You need to call fflush(fptr); before fclose(fptr);
Shao Voon Wong 6-Apr-22 23:28pm View
A database usually does not store images. They only store the image filenames. You go ask your manager or customer where the images are stored and for every image, combine the filename with that folder path to get the full path to retrieve it.
Shao Voon Wong 1-Apr-22 3:28am View
From my experience working with IP cameras, there is no need to learn these technologies as the IP camera manufacturer provides the SDK to its customers. The SDK is easier to work with than these technologies. Just request from your IP camera supplier.
Shao Voon Wong 1-Apr-22 0:30am View
Your error message mentioned syntax error: 'string' but the code snippet you posted does not have 'string'. Please post the actual source code with 'string' so that we can fix it for you.
Shao Voon Wong 29-Mar-22 9:50am View
template <typename t>
typename std::list<t>::iterator HashTable<t>::findItem(T key)
int index = hashFunction(key);
typename std::list<t>::iterator i;
Shao Voon Wong 29-Mar-22 8:25am View
You misplaced your ) and do not escape your single quotes

SqlString.Format(_T("SELECT User_Name FROM nurse_login.nurse WHERE User_Name = \'%s\'"), (LPCTSTR)str);

Let me warn you that concatenating SQL strings can result in SQL injection that brings your DB under the control of hackers.
Shao Voon Wong 29-Mar-22 7:06am View
You can try to use LPCTSTR. Your access violation might not be related to the warning.

Shao Voon Wong 17-Mar-22 4:26am View
Your code has many ternary operators which involve branching:

g2 != g1 ? 587 : 0

You can try table lookup.

char table[2] = {0, 587};

table[(g2 != g1)]; // not sure GCC allows boolean as integer index.

But in real life, I find it makes no difference because the time to fetch the table is the same as the branching.
Shao Voon Wong 17-Mar-22 3:13am View
Using float conversion is actually faster than pure integer for computation. Not sure if it applies to embedded code. See the link below.
Shao Voon Wong 9-Feb-22 22:58pm View
Are the 2 PC OS the same? Most probably the new dll needs another dll not present in your other machine.
Shao Voon Wong 21-Jan-22 2:52am View
If you make createWindow() a constexpr function and the if condition a constexpr if condition, the result is the same. All the code paths/branches in constexpr if must make sense to the C++ compiler.
Shao Voon Wong 20-Jan-22 22:38pm View
createWindow() will fail to compile under Windows Compiler because Apple code is visible to it. Likewise for Apple compiler.
Shao Voon Wong 20-Jan-22 2:04am View
Or you can run the VS2017 installer again. Remember to select v141 toolset.
Shao Voon Wong 20-Jan-22 1:31am View
It is around there in Configuration Properties or it may be named differently. You can find it.
Shao Voon Wong 3-Jan-22 2:57am View
If you are planning to use a makefile to compile and link C++ code, then learn CMake instead.
Shao Voon Wong 3-Jan-22 2:12am View
Codeproject has one highly-rated Makefile article.
Shao Voon Wong 27-Dec-21 21:58pm View
The key is int type which is binary when written to the file. Convert the key to char array.
Shao Voon Wong 16-Dec-21 2:38am View
You can write a Visual Studio Extension to extend its functionality if that's what you meant by using your APIs.
Shao Voon Wong 13-Dec-21 5:01am View
Thank you.
Shao Voon Wong 12-Dec-21 0:35am View
If the finalizer throwing exception in GC is indeed the problem, I propose 4 solutions. Solution A: Call GC.SuppressFinalize(this); at the end of all your C# finalizers. Solution B: In your C# finalizers and C++/CLI destructors, check a reference or pointer is not null before using it and set it to null after freeing/cleaning up. Solution C: Put the try-catch block in all your C# finalizers and C++/CLI destructors to catch the Access Violation exception. Solution D: Best if implementing all three A, B and C solutions but note A, B and C alone is sufficient to fix the problem on their own.
Shao Voon Wong 11-Dec-21 21:33pm View
The two vectors need to be sorted before calling std::set_union().
Shao Voon Wong 11-Dec-21 21:21pm View
In .NET, the finalizer can be called twice. Once you have run the finalizer, remember to call GC.SuppressFinalize(this); to prevent the 2nd run else you get an exception because the object has already been cleaned up. Below is the link on how to implement IDisposable pattern.
Shao Voon Wong 11-Dec-21 0:19am View
Not possible for anyone to find the error without access to the source code. I suggest you search in your codebase for all the "null", "NULL" and "nullptr" assignments and check if the null pointer is used without first initializing with a valid object/array.
Shao Voon Wong 10-Dec-21 2:40am View
If you run your application under the VS debugger, it can show you the call stack whenever the exception happens. Your code is accessing a NULL pointer which causes the access violation.
Shao Voon Wong 18-Nov-21 0:08am View
If you want the member to be private, then add getter and setter as suggested by k5054 above and call those to access member.
Shao Voon Wong 17-Nov-21 22:52pm View
Put "public:" at the top of the class to make your members publicly accessible.
class COD_player{
string name,id,username,password;
Shao Voon Wong 17-Nov-21 20:59pm View
COD_player p1; // constructor will be called implicitly;
Shao Voon Wong 11-Nov-21 1:46am View
Follow these links for packet capturing. Filter them on your own after capturing.
For Linux, libpcap:
For Windows, WinPCAP: or
Shao Voon Wong 9-Nov-21 2:18am View
int len = strlen(name[i]);
if (len > 0 && name[i][len - 1] == '\n')
name[i][len - 1] = '\0';
Shao Voon Wong 8-Nov-21 23:54pm View
Try adding \n your last printf(). \n flushes the output to display. See below.

printf("%d\n", a);
Shao Voon Wong 21-Oct-21 3:47am View
You can follow my tip on unordered_map: to avoid the std::string instantiation during find. In my experience of a switch statement with a few hundred of cases because I have that many message types to process, unordered_map can be faster because there are many branching in this massive switch-case. Of course, your mileage may vary. When you only have a few if-else, I'll say don't bother.
Shao Voon Wong 20-Oct-21 6:50am View
You can try std::unordered_map which is a hashed table.
Shao Voon Wong 14-Oct-21 22:25pm View
Shao Voon Wong 8-Oct-21 2:48am View
Shao Voon Wong 2-Aug-21 7:33am View
Follow Greg Utas link to set up your compiler for symbols and variables, it should work because I use the same settings. If you are using WinDBG to attach your 3rd party application, use 'x' command to find your function symbol. Say your function is func, do this: x *func* and after finding the full decorated name, set an unresolved breakpoint: bu MyDll!funcXYZ. The breakpoint will be set when your dll is loaded and break when the function is called. *Update* I just saw your reply to Greg that you use CLR. I do not have experience in CLR debugging. Forgot what I have just said.
Shao Voon Wong 14-May-21 2:13am View
I suggest you put these steps in the post-build event of the C++ COM project so that your C# project always gets the latest COM object.
Shao Voon Wong 12-May-21 23:35pm View
Did you unregister the old COM object before registering the new one? You can remove the old COM reference from the C# project and add new one again and recompile.
Shao Voon Wong 17-Apr-21 2:51am View
Assuming you put orders.db in the temp folder in the C drive. This is how you would specify it in read_orders. As for the command line, you can google it.

struct order *orders = read_orders("c:\\temp\\orders.db", &num_orders);
Shao Voon Wong 16-Apr-21 23:30pm View
You can try an absolute path to the file, instead of a relative path.
Shao Voon Wong 11-Mar-21 20:39pm View
MSVCR71.dll corresponded to VS 2003 runtime. You may be using an old 3rd party library that was built with VS 2003. Install this library on other laptops (before running your application) may solve your problem.
Shao Voon Wong 11-Mar-21 19:57pm View
Which version of Visual Studio are you using? Download and install the Microsoft Visual C++ 20xx Redistributable Package from

Please download the one that corresponded to your VS version.
Shao Voon Wong 4-Mar-21 19:58pm View
Shouldn't you be showing the non-working C++ code instead? Without reading the C++ code, no one can be sure of what went wrong.
Shao Voon Wong 25-Feb-21 1:11am View
Did you add gnuplot's include path to the Visual Studio's directory? Right-click on the project (that use gnuplot) in the Solution Explorer, select Properties in the popup menu.

Configuration Properties -> VC++ Directories -> Include Directories
Shao Voon Wong 21-Feb-21 22:22pm View
You should ask in the Github link you provided. Only the author knows best how to build.
Shao Voon Wong 15-Feb-21 21:30pm View
Very hard to evaluate whether pinning is needed or not when the class details are not revealed. If you are using C++/CLI (the managed C++), you can pass a reference to the array to it to keep, only pin one element at a time when you need to access or assign it to the native C++ object/variable. Pinning is a very expensive operation that slows down the GC cycle considerably.
Shao Voon Wong 15-Feb-21 21:24pm View
To keep it simple, the C++ function should just find the names and return the found names to WPF.
Shao Voon Wong 5-Feb-21 8:12am View
Shao Voon Wong 4-Feb-21 1:44am View
Your C++ DLL project probably does not have x64 profile. Open the Configuration Manager to create one.

You have to figure out how to use the configuration manager. Teaching you would take me many screenshots. Configuration manager can also show if your C# application is AnyCPU or true 32-bit. Good luck!
Shao Voon Wong 3-Feb-21 2:09am View
Write a simple project to reproduce the problem and upload it to GitHub and I'll take a look.
Shao Voon Wong 2-Feb-21 7:13am View
Why do you want to pin it?
Shao Voon Wong 1-Feb-21 6:25am View
You can take a look at
Shao Voon Wong 1-Feb-21 6:05am View
The application in that article is a winform. Is yours a winform or commandline app? Does your C function call COM functions?
Shao Voon Wong 1-Feb-21 5:22am View
Did you try to return a char* as string to C#?
Shao Voon Wong 1-Feb-21 4:55am View
Make sure the dll is inside the executable directory and the calling conventions are the same.
Shao Voon Wong 24-Jan-21 4:46am View
WinForm and WPF already call CoInitialize/CoUninitialize on your application's behalf. If you call CoInitialize() again with a different apartment, it will fail. I am not sure about CoInitializeSecurity: I suppose you can call it in DllMain() 's DLL_PROCESS_ATTACH. You can use a COM object in C# directly than going through pinvoke route. You can google or read the documentation of your COM component.
Shao Voon Wong 29-Dec-20 2:22am View
Shao Voon Wong 22-Dec-20 23:05pm View
Your code looks fine. The problem could be the compiler cannot find the class declaration/definition you supplied to std::function.
Shao Voon Wong 22-Dec-20 22:55pm View
Then your error in your post is misleading. Please include the actual error messages.
Shao Voon Wong 20-Dec-20 19:36pm View
You should mark Rick York's post as the answer in that case.
Shao Voon Wong 14-Dec-20 2:42am View
Shao Voon Wong 20-Nov-20 4:31am View
This is a new question which you should post in another Q&A.

Your code is in a mess. Why did you spawn another thread in WaitForConsumer()? I do not know what you are trying to do. This is the code sample which should work.

typedef std::function < void(const char*,int) > ConsumerCallback;

class first
void ConsumeMessage(ConsumerCallback callback);

void ConsumeMessage(ConsumerCallback callback)

.... used ConsumerCallback 


class second 
boost::thread *start;
bool isThreadInterrupt;
void WaitForConsumer(const char* message, const int& length);
void Test();
void start();
void stop();

isThreadInterrupt = true;

void WaitForConsumer(const char* message, const int& length)
  start =  new boost::thread(&second::Start, this);
  printf("isThreadInterrupt: %d\n", isThreadInterrupt);

void start()
   isThreadInterrupt = true;
   isThreadInterrupt = false;  

void stop()
    // Thread already ended when joined in WaitForConsumer()
	// so cannot call interrupt() and join()
    // start->interrupt();
    // start->join();

void Test()

first obj;
// inside WaitForConsumer will spawn a thread.
obj.ConsumeMessage(std::bind(&second::WaitForConsumer, this, 
    std::placeholders::_1, std::placeholders::_2));
Shao Voon Wong 20-Nov-20 1:06am View
startThread->join(); will only return when the thread has ended. If the thread is still running, the code after join() has no chance of executing. ConsumeMessage() maybe blocking the thread from completing. And where did you set isThreadInterrupt? In WaitForConsumer()?
Shao Voon Wong 20-Nov-20 0:23am View
I am not sure how your code is going to work since I did not see the whole code. isThreadInterrupt should be checked inside the lambda. The lambda is the function that the thread calls to do the work.

std::thread *startThread= new std::thread([&](){

while(isThreadInterrupt) // set it to false to stop the while loop
    obj.ConsumeMessage(std::bind(&second::WaitForConsumer, this, 
        std::placeholders::_1, std::placeholders::_2));
Shao Voon Wong 16-Nov-20 0:57am View
There is nothing wrong with your code. A common mistake with image assets is the files are added to the project folder but forgotten to add to the debug or release output folder, so the program runs fine in Visual Studio but fails to load the image when the executable is launched elsewhere.
Shao Voon Wong 2-Nov-20 18:45pm View
Can you upload to GitHub, a sample project that reproduces the problem? Because I cannot find an addSubItem method that matches your arguments. You are not supposed to cast string literal to _variant_t: those are 2 different types.
Shao Voon Wong 2-Nov-20 1:09am View
For purpose of your exercise, you can use std::vector to implement your stack. std::vector is a dynamic array that can expand and shrink. STL already has a stack implementation that you can use.
Shao Voon Wong 27-Oct-20 20:44pm View
Can you upload your blank MFC app (that reproduce the problem) to GitHub and we'll take a look.
Shao Voon Wong 27-Oct-20 5:14am View
Do you mean tooltip?
Shao Voon Wong 27-Oct-20 5:12am View
Thanks! Your answer got my 5 as well!
Shao Voon Wong 21-Oct-20 7:13am View
Shao Voon Wong 15-Oct-20 23:36pm View
Good link!
Shao Voon Wong 13-Oct-20 5:49am View
Shao Voon Wong 13-Oct-20 1:02am View
My 5!
Shao Voon Wong 2-Oct-20 22:02pm View
This is because num is displayed first before incr10() is called. Try setting the C++ Standard to C++17. Under C++17, the order of execution is guaranteed.
Shao Voon Wong 30-Sep-20 5:25am View
OP likes to ask questions on MFC. I advise him to learn MFC properly from a book.
Shao Voon Wong 29-Sep-20 7:58am View
How do you define FSM_MESSAGE?
Shao Voon Wong 24-Sep-20 3:42am View
It is for the OpenGL application to use.
Shao Voon Wong 23-Sep-20 22:04pm View
Right-click on the glmf.dll in File Explorer to show properties and click on the details tab, it shows OpenGL Metafiling DLL. It is a library for OpenGL.
Shao Voon Wong 23-Sep-20 21:46pm View
Just download dependency walker to open glmf.dll to see what functions are exported from it.
Shao Voon Wong 21-Sep-20 7:39am View
What are the 'other apps'?
Shao Voon Wong 21-Sep-20 3:35am View
Is your MFC application a SDI/MDI application?
Shao Voon Wong 4-Sep-20 23:54pm View
Add const to the printError parameter in both the function declaration and definition.

void printError( const TCHAR* msg )
Shao Voon Wong 21-Aug-20 7:39am View
Don't bother to write a .X importer yourself. It is a very complicated file format. No parser existed yet that can load all .X out there, last I checked.
Shao Voon Wong 20-Aug-20 19:32pm View
Yes, it should work.
Shao Voon Wong 19-Aug-20 21:15pm View
Find out the DirectX version your project is using and install its SDK and reference the headers and libs accordingly.
Shao Voon Wong 14-Aug-20 23:58pm View
I believe the default button style depends on the OSes. The first picture is button style on Win8/10 while the 2nd picture is button style on Vista/Win7.
Shao Voon Wong 9-Aug-20 8:34am View
Benchmark your optimized version against your vanilla version to see any speedup before further optimization.
Shao Voon Wong 27-Jul-20 5:52am View
Thanks Maciej! You saved my day again!
Shao Voon Wong 27-Jul-20 5:15am View
Thanks. It worked better than my solution because when there are 2 rows with same salary, it displayed both.

Thanks again.
Shao Voon Wong 27-Jul-20 4:09am View
Just add 2 methods, HasError() and GetLastError(). Keep the interop simple.
Shao Voon Wong 27-Jul-20 2:04am View
Hi, I have put sample code at GitHub.

Click the "Create Server" button, then click the "Send Cpp Msg" button to simulate a signal from Cpp Server to tell C# to get the message.
Shao Voon Wong 24-Jul-20 23:59pm View
I do not see any relevance of your post to OP's question but I want to thank you for the link. Just learned something useful today. Shuffling is something I do quite often in my hobbyist projects. Up to today, mostly doing the naive shuffle. Thanks again!
Shao Voon Wong 24-Jul-20 23:55pm View
Remember to turn on the optimizer and build in Release mode in VC++. Debug mode has all sorts of checks which slows down the execution.
Shao Voon Wong 22-Jul-20 3:01am View
Have you built and register IProgressDialogPtr's COM dll on the computer which has VS2019?

To register your COM dll,

regsvr32.exe your.dll

To unregister your COM dll,

regsvr32.exe /u your.dll
Shao Voon Wong 19-Jul-20 2:52am View
nip is a foreign key column that references the school table. Has the school table (with the NIP column) been created on the database before running this SQL statement?
Shao Voon Wong 17-Jul-20 3:03am View
If you have worked with OpenGL on a few projects, you should be able to figure it by yourself. Button is just a rectangle with 2 triangles and render it last after all the 3D objects but remember before rendering the button, set to orthogonal mode, and disable the depth testing. The mouse click detection depends on the UI framework: if using win32, check the WM_LBUTTONDOWN message on your HWND.
Shao Voon Wong 17-Jul-20 0:23am View
Without knowing your FunctionFor internals, your for-loop seems correct: you may want to unwrap FunctionFor's code because there is an overhead for function call.

For PPL, it seems including the header is sufficient.
Shao Voon Wong 16-Jul-20 21:48pm View
Shao Voon Wong 14-Jul-20 4:07am View
You can do the cause elimination by commenting out the lines starting from the bottom until the crash does not happen. Then you know the recent commented-out line is the cause.
Shao Voon Wong 14-Jul-20 3:56am View
Remember to make the function and the function pointer the same calling convention, as mentioned in your previous question thread.

The function declaration should be

siRuleReturn* WINAPI FireRule(CObList& list);

And the function pointer declaration should be

siRuleReturn* (WINAPI* FIRERULE)(CObList& list);
Shao Voon Wong 14-Jul-20 3:44am View
Shao Voon Wong 14-Jul-20 3:19am View
It is because your C-style cast silence the compiler. No compilation error for the code below. This is why C-style cast is discouraged.

CString* p_str = new CString(L"Hello");
CObject* p_obj = (CObject*)p_str;

But this original code will have a compilation error.

CString* p_str = new CString(L"Hello");
CObject* p_obj = p_str;

Shao Voon Wong 13-Jul-20 6:27am View
The function declaration should be

siRuleReturn* WINAPI FireRule(CObList& list);

And the function pointer declaration should be

siRuleReturn* (WINAPI* FIRERULE)(CObList& list);

In the past I encounter code worked in older VC++ but crashed in the newer VC++. Turns out the bug is in our code because the function accessed an element past the end of the vector. It did not crash in the old VC++ because there is nothing at the end of the vector to corrupt. Code-review the FireRule code is correct and is not accessing out of bounds.
Shao Voon Wong 13-Jul-20 2:03am View
Probably, FireRule() and its function pointer, FIRERULE declaration mismatched? Please show the 2 declarations.
Shao Voon Wong 11-Jul-20 5:46am View
Check whether hModule and pFunc is NULL. Check siJCLJOb.dll is in the executable path. If they are correct, then it could be the VC runtime for siJCLJOb.dll is not found/installed. Try installing VS2010 runtime.
Shao Voon Wong 10-Jul-20 3:01am View
Where did you download the SliderCtrlEx from? You can ask the author on how to use it with MFC. Alternatively, MFC has its own CSliderCtrl class for slider, you could use that instead.
Shao Voon Wong 25-Apr-20 6:00am View
What is the console output? Disconnect might be set to true by default?
Shao Voon Wong 19-Mar-20 3:23am View
Thank you! Learn something useful from you, 5 stars from a fellow WinAPI and MFC developer.
Shao Voon Wong 4-Mar-20 22:55pm View
By right, you only load the image once and display it in OnDraw().
Shao Voon Wong 4-Mar-20 19:16pm View
You can try overriding your WM_SIZE handler so that it redraws your View after resize is done.

	ON_WM_SIZE() // add this line to your message map

void CChildView::OnSize(UINT nType, int cx, int cy)
    CView::OnSize(nType, cx, cy);
    Invalidate(TRUE); // add this line to redraw your CChildView
Shao Voon Wong 3-Mar-20 19:34pm View
You are calling accept twice! First call in the while condition and second call is in the while loop. Remove one of them.
Shao Voon Wong 10-Feb-20 8:36am View
5! Reference has a more natural syntax compared to pointer.
Shao Voon Wong 10-Feb-20 7:49am View
Shao Voon Wong 2-Feb-20 4:33am View
5! I think this is exactly what OP needs instead!
Shao Voon Wong 10-Jan-20 6:10am View
Shao Voon Wong 1-Jan-20 4:30am View
If you have solved your problem, remember to mark your question as solved so that the poster who provided you the answer, can get some points.
Shao Voon Wong 26-Dec-19 6:02am View
It still needs MS Office when it runs.
Shao Voon Wong 24-Dec-19 2:37am View
Your code looks correct through send/recv should be used together. My assumption is your client crashed before it can send its message to server, when it displays "Hello, World!" because that string is not null terminated. Try the send code below.

if(send(newsockfd, "Hello, World!\0", 14, 0) < 0){
Shao Voon Wong 22-Dec-19 4:37am View
BASIC is using an interpreter to interpret and verify the code before running it while C++ is a compiled language that needs everything to be compiled successfully before running. A compiled language is usually faster at running than an interpreted language. I hope I clear your doubts.
Shao Voon Wong 22-Dec-19 3:15am View
In C++, you have to compile and link the executable before running it. Just compile it successfully and run sample program.
Shao Voon Wong 12-Dec-19 7:26am View
Maybe your dll is outdated. Try clean and rebuild the dll project and copy the dll to the executable folder.
Shao Voon Wong 12-Dec-19 6:57am View
Please show how you got the function pointer to that function in the dll.
Shao Voon Wong 27-Nov-19 7:11am View
You are welcome. Glad to be of help.

Without calling join(), how do you know the worker thread has ended? We usually start the thread, and do other stuff in the main thread before calling join() so that the main thread execution is not blocked by join().

Just to let you know std::cout is not thread-safe. If the main thread and worker thread called std::cout at the same time, the console output may contain gibberish.
Shao Voon Wong 27-Nov-19 6:45am View
Did you call join() on the thread object before the program ends?
Shao Voon Wong 27-Nov-19 6:41am View
Make sure the main thread and worker thread do not access the same object at the same time, else it leads to memory corruption and incorrect result and crashed the application. You can guard the same object with a mutex to avoid that.
Shao Voon Wong 27-Nov-19 6:37am View
I have updated my answer below. You have to call join() to know the thread has finished executing.
Shao Voon Wong 27-Nov-19 6:24am View
See my answer below.
Shao Voon Wong 27-Nov-19 6:23am View
Tough luck!
Shao Voon Wong 27-Nov-19 6:21am View
See my reply below
Shao Voon Wong 27-Nov-19 6:14am View
clrscr() is only available on Borland Turbo C++ compiler. Are you using that compiler to compile?
Shao Voon Wong 27-Nov-19 6:12am View
That was the old error! Just remove the ; from that line.
Shao Voon Wong 27-Nov-19 6:10am View
What is the type of ptrGrabResult? Specify that type as the lambda parameter which is uint32_t at the moment. Give that parameter an unique and meaningful name, not i which is used in the lambda body.
Shao Voon Wong 27-Nov-19 6:05am View
What is the new error? And which line?
Shao Voon Wong 27-Nov-19 5:27am View
Seems like Turbo C++ code. Is the compiler Turbo C++? Visual C++ may not compile this code. And you neglect to mention which line has the error.
Shao Voon Wong 27-Nov-19 5:13am View
You are just trying to steal sensitive information like Bitcoin wallet, password, serial number or credit card numbers. If even Spy++ cannot see the HWND, you can forget about getting the HWND because the control may not even implemented using HWND.
Shao Voon Wong 27-Nov-19 4:31am View
Why are you trying to get HWNDs from Spy++? What are you going to do with the HWNDs?
Shao Voon Wong 27-Nov-19 4:10am View
Are you trying to get HWnd of other applications not written by you? Even you got their HWnd, you cannot SendMessage() to them because on modern Windows OSes, MS disallows cross-process communication through sending WinAPI message due to security concerns.
Shao Voon Wong 27-Nov-19 4:03am View
From your code snippet, it looks like not MFC code. Please post the actual problematic code because WinAPI application starts in WinMain() not main().
Shao Voon Wong 24-Aug-19 6:10am View
To capture other application window, you need to have their window handle to get the hDC. Is capturing the desktop enough?
Shao Voon Wong 24-Aug-19 6:00am View
You should have made sure the 32bit is working first.
Shao Voon Wong 24-Aug-19 3:05am View
Does it work correctly in 32bit on VS 2017? Did you tried clean and rebuild the projects?
Shao Voon Wong 19-Aug-19 6:01am View
You can remove unique_ptr

map<int, inputscale> inputScales;
Shao Voon Wong 23-Jun-19 7:23am View
Try drawing a triangle without normal first.
Shao Voon Wong 23-Jun-19 5:44am View
Your indices are funny. There are usually more indices than vertices. Vertex should not be repeated else it defeats the purpose of using indices. Indices should be in this pattern.

0, 1, 2,
0, 2, 3,
1, 4, 5,
1, 5, 2, ...

Since your vertices is the whole model, you should ditch indices and call Draw(), not DrawIndexed(). Do not send your indices to DX context in this case.
Shao Voon Wong 23-Jun-19 5:33am View
Your vertex and pixel shader are the same file! For me, they are usually in separate file.
Shao Voon Wong 1-Feb-19 6:24am View
You need to show your serializing code too, else how do we know what went wrong.
Shao Voon Wong 30-Jan-19 8:20am View
I do not remember if text display is taught, but static text is just transparent texture. You can implement your own font atlas class where each character is a texture. Google "OpenGL font atlas"

I implemented a static text display in this Youtube video.

Rotation is covered. Font selection code can google yourself. Since my slide show app is mainly quads, I do not pay attention to those advanced OpenGL topics. The waterfall is definitely not taught in the course.
Shao Voon Wong 29-Jun-15 23:33pm View
Assuming all data are received as OP said, is fflush() called at the end? As another poster mentioned, UDP is unreliable. Use of UDP usually have TCP as fallback in case of dropped packets. How OP know there is no dropped packets, is sequence number correct in the packets? You have to implement your own seqnum in UDP.
Shao Voon Wong 8-May-14 21:07pm View
Do you know the tags in the XML beforehand?
Shao Voon Wong 5-May-14 21:44pm View
2 complete answers! 5 from me!
Shao Voon Wong 8-Jan-13 22:19pm View
OpenGL API is a C language based. They don't throw exceptions unless the C++ wrapper you are using, does that. You should always check for shader compilation errors. I think you are better off posting your shader code and your graphics card specs in an new question. Right now, I can only wild-guess what went wrong.
Shao Voon Wong 8-Jan-13 22:19pm View
OpenGL API is a C language based. They don't throw exceptions unless the C++ wrapper you are using, does that. You should always check for shader compilation errors. I think you are better off posting your shader code and your graphics card specs in an new question. Right now, I can only wild-guess what went wrong.
Shao Voon Wong 8-Jan-13 21:30pm View
There are different versions of GLSL. Have you checked whether your graphics card support that GLSL version you are using? Is there any error in the shader compilation?
Shao Voon Wong 11-Feb-11 4:50am View
Reason for my vote of 5
Really useful!!