16,004,647 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 Yount_0701 (Top 57 by date)
Yount_0701
11-May-24 7:37am
View
I tested and figured out that `That can't be the underlying issue; you must be hitting an issue with the write part.` as you said before was NOT CORRECT.
If you open file with zero-share-mode and not close the file handle, you tried to open the same file again somewhere or other process , you will meet the ERROR_SHARING_VIOLATION issue. Even if you use `CopyFile` function , the problem would be the same because copy file also need to open the file. If you use windows notepad to open the same file before the file handle was closed , same warnings would popup. And Yes I tested. The File System restrict that kind of operations. You need to close the file handle first and then re-open it, or you should not use zero-share-mode.
Yount_0701
11-May-24 3:49am
View
`CopyFile is a none-blocking file on the read operation. That can't be the underlying issue; you must be hitting an issue with the write part. ` I have been coding and test , that's NOT TRUE. `CopyFile` also need to read the file content, which as you referred below , zero-share mode file in use CAN NOT been copied , and the error code would be ERROR_SHARING_VIOLATION.
Yount_0701
10-May-24 18:41pm
View
Memory always faster then storage. Ring buffer chain has been applied to many places. My coding right now is not that much required about performance yet, maybe the next step to think about later. But your ideal still a good try as I see. My problem is , my code still not working so far , because of zero-shared open mode as referred.
Yount_0701
10-May-24 6:01am
View
`That can't be the underlying issue; you must be hitting an issue with the write part.`
Thank you , that's a confirm, I like this kind of talk . @Pete O'Hanlon and @CPallini
If so , something was wrong with my coding logic. I'm gonna to figure it out.
Yount_0701
10-May-24 5:52am
View
I prefer to pesume if there is a way to open a file in use by another program and read the content properly. Your suggestion may be right , but lead to different path away from my thoughts.
Yount_0701
10-May-24 5:43am
View
uh, could I tell that even if the source file in use `CopyFile` will not fail, only the destination file may cause this trouble ?
If so, I have to assume my logic problems , maybe my `CopyFile` operations did too offen which the previous procedure not done yet , new `CopyFile` comes.
After code checking , that's not supposed to happen , all `CopyFile` operations have been done in one single thread one by one , no chance happend concurrently.
Yount_0701
10-May-24 5:20am
View
My purpose is to parse the logging text generated by program A while it's working. I'm hoping there is a proper method to re-open the logging files while program A is just writing these files.
Yount_0701
10-May-24 5:17am
View
um, It's something like this
Program A writes logging text files which is a binary file programed by someone and work on my computer. I'm now using program A and I want to analysis the logging text and do something else when program A was running. Program A is using the logging file for sure and I open these files again which cause the culprit.
Yount_0701
1-Jan-24 22:46pm
View
Without message registration and the message queue management , the coding job would be a little easier. It's basically useful for some code chunk with a lot of switch...case or if/else caluse.
Yount_0701
15-Dec-23 0:20am
View
Deleted
And also, your code of event capture is just not correct. So far after all my experience turned out it should be window.onbeforeunload or/and window.onunload , NOT window.onload. The problem of the switching into new console context is caused by the uncheck item "keep logging" on the console panel of DevTool interface.
Thanks a lot.
Yount_0701
21-Nov-23 5:32am
View
Your words definitely not a solution. I add some details after 10 months. If you have time , hope you review these detail , and mostly , hope you finish your solution , lol.
Thank you.
Yount_0701
21-Nov-23 5:15am
View
I'm not sure you get me, but I'm sure I don't get you or your direction (Frankly , your code is not that much different from mine in my question , I hope you do not get messed , as far as I see , depend on my apprehension . If not , it's the problem of my apprehension).
I find a way to deal with it , not perfect , but work. As for your solution , I'm not gonna to buy it.
I use ajax/xhr to request the page label href and parse the response , I'm lucky as for the response has no dynamic DOM ops generated by js, and the href has no cross-origin problem so far, simple and work.
The problem is still there , you guys walk around my question , and then I changed my idea , and walk around my problem .
Yount_0701
20-Nov-23 9:32am
View
I'm not arguing with you. It's a tech question first, and I'm not a criminal. When new href loaded , the console context switched and pre-page console output no access , no output gather , that is the fact I faced and this is a tech community as I thought. If my description not wrong , you have to admit that it's a question first. No offense , you guys have special talent of teaching lessons , lessons walk around my question but just not step into it.
Yount_0701
19-Nov-23 4:59am
View
First of all , I have to thank you for your attention and your direction code.
Perhaps my description is not clear , As my mention in the question , what I'm doing is first click the 'next page', then load the new page , and scrape items info, then click 'next page' and so on. My code register the window load event , but when the page clicked , the console (F12 DevTool interface) switched into a new context, I can not get any output about the new page loaded event, which I query from new page DOM document, and use console.log() to print in the console context. What I hope is that the console should print the new page item content . That's one problem , and second , I'm not sure the listener on window's load event is capable or correct to finish my job ? Sincerely , thank you.
Yount_0701
19-Nov-23 2:55am
View
Sorry , I don't get you. In your code , button.form , where is the form ? The page label is a
label with href, when you click the page label, it will locate to the href specified by href atrri of [a] , I'm not sure there is a form or a POST event.
Yount_0701
18-Nov-23 18:53pm
View
let's see this website link https://movie.douban.com/review/best/.
It's a movie comment list, at the bottom with page links. If you click into different page link, new comment will come up. I want to scrape these comments , and I don't want to click each page link by hand , I hope js code could do this instead.
Yount_0701
17-Nov-23 9:14am
View
That's a good ideal, I tried and it works. I paste the alter code.
Yount_0701
16-Nov-23 21:22pm
View
Yeah, my code did nothing to alter the html content , the page label click event did it.
All I do is to simulate the page label click event. without my code , you can click the page label directly , then you will see the content changed , which all have been done by the original html js code itself. Here I'm doing is using extra injected js code to simulate this operation.
Yount_0701
16-Nov-23 21:15pm
View
Deleted
Yeah, my code did nothing to alter the html content , the page label click event did it.
All I do is to simulate the page label click event. without my code , you can click the page label directly , then you will see the content changed , which all have been done by the original html js code itself. Here I'm doing is using extra injected js code to simulate this operation.
Yount_0701
16-Jul-23 4:08am
View
you're right. "i.querySelector('.slide-item-wrap').click();" doesn't go well.
After I put await before this line, everything OK.
Yount_0701
2-Apr-23 1:47am
View
there are some articles talk about ABA problems, I'm not sure it's OK or not.
typedef enum {
LOCK_IS_FREE = 0,
LOCK_IS_TAKEN = 1
} LOCK;
void Lock(LOCK* pl) {
while(_InterlockedCompareExchange((long*)pl,LOCK_IS_TAKEN,LOCK_IS_FREE)== LOCK_IS_TAKEN) {
//block until switch , according msdn.
}
}
void Unlock(LOCK* pl) {
_InterlockedExchange((long *)pl,LOCK_IS_FREE);//make the switch manually.
}
Yount_0701
1-Apr-23 21:12pm
View
how about if I use lock to wrap around the operation functions (Link_Delete/Link_Append) ?
like this :
Link_Delete(...) {
Lock(&p->lock);
//....;
Unlock(&p->lock);
}
Yount_0701
1-Apr-23 8:35am
View
If I use the CAS check-and-update loop, could it avoid the concurrency problem?
Yount_0701
14-Mar-23 22:16pm
View
Thank you. Your lib do a lot of work. That's great , which make me realize it's a huge work to have I want to be done. I have to considered if it's worth to workaround.
Yount_0701
14-Mar-23 21:33pm
View
Thank you.It's much simple if I use Gdiplus libs as you said.
1.Creating a IStream interface which consume the buffer which I recveived;
2.Using Gdiplus::Bitmap::FromStream(...);
3.Using Gdiplus::Bitmap::GetHICON(&my_icon);
perhaps this is the normal procedure of doing this work. Like I said, my program structure is not allowed to import Gdiplus libs for some reasons.
Yount_0701
28-Feb-23 2:56am
View
Impressive. I have a lot to learn.
Yount_0701
12-Feb-23 21:00pm
View
Thank you. I think I have got some of it.
Webview2 using COM tech, pre-provide interface to access local components.
The implement of invoke interfaces / virtual classes make codes massive. On another hand, constructor may cause serious memory expense during value passing ( we could avoid this by using pointer but need to manage the release of object pointer, not convenient), especially in this case , the web browser component which would be expensive for sure. rvalue reference make sense.
Yount_0701
24-Jan-23 21:21pm
View
funny.
Yount_0701
24-Jan-23 21:15pm
View
what is the "writing wheel extension part V"? some kind of guide tutorial?
Yount_0701
24-Jan-23 21:06pm
View
how about strtol, but the return value is an 8 bytes datatype(long). Anyway the two-byte variable also has an overflow risk.
Yount_0701
24-Jan-23 6:55am
View
calm down. it's just a question for answer, mostly for me, for direct answer. I have not got it not because of you, frankly it's because of my poor coding experience and limited apprehension. Some rookie desired to figure out what's wrong , maybee a little hurry. No need to argue. Thank you @OriginalGriff honestly and Sorry for waste your time.
Yount_0701
24-Jan-23 6:43am
View
Thank you for your patient and your code. Your code point out the problem which I was wrong for so long.
And for the parameter "format". At first on my mind it seems have diffenect ways to handle between function printf and function vsnprintf.
I always think printf(msg) is OK, well it's not. It seems the va_arg would try to parse parameter first and then access the function stack parameter from va_list.
I should read more carefully about the va_list marcos in stdarg file. After some code experiences , I lost the correct direction on the judgment of troubleshooting.
I also have no idea about how to debug.
That is totally a big embarrassment.
Yount_0701
24-Jan-23 5:09am
View
I read your comment again, right now I'm not sure what you are talking about. I believe this is not a very deep or hard question. I try my best to show what am doing and what am expected. At last I show my code together with result pictures. I think you have already be clear about my stuck and my perpose. I believe there is an certain answer about it. Also I'm sure we could both make a progress by present coding on this topic.Otherwise, repeat reading don't make any sense. Thank you@OriginalGriff
Yount_0701
24-Jan-23 4:43am
View
https://sm.ms/image/3iQWTMkSCcFeNYa
The same story.
Yount_0701
24-Jan-23 4:38am
View
The protype of printf also support call printf(msg) directly. From my experience of coding,if the format string has no converting characters like % , \ , va_list will not crash anyway, it would print the msg directly. And the result of pics would say the same thing.
Yount_0701
24-Jan-23 4:31am
View
https://sm.ms/image/3iQWTMkSCcFeNYa
Now what ? guys?
Yount_0701
24-Jan-23 4:15am
View
https://s2.loli.net/2023/01/24/XvzekrQgT4c853i.png
the pics show the result. forget about LOG function before the vsnprintf_test really works.
You said no confused me, could you plz show me your exact way by code?
Yount_0701
24-Jan-23 4:10am
View
As the comment before this, it's not work,that's my test on my MSVC environment. In case of cheap talk , I provide the pics here https://s2.loli.net/2023/01/24/XvzekrQgT4c853i.png
Yount_0701
24-Jan-23 3:50am
View
quote "%A" which is an unrecognised print format. Pass it "%s" instead, and it'll work.
you mean vsnprintf_test("%s",msg)? Do you ever try? Does it work ?
As far as I have done, apparently the output was not what we expected.
Hold on before go back to LOG function , because here on my msvc , the output was not "%A" even if I adjust the caller like "vsnprintf_test("%s",msg)",it's still something like "0X0.0000000000002P-1022" , nonsense as adjust before.
Yount_0701
13-Jan-23 2:19am
View
I tried to change the font for the device context, it worked !
Thank you. The problem is the font !
Yount_0701
21-Nov-22 22:44pm
View
So far from what I know tooltip control messages have nothing to do with what I concern. They are internal messages for the tooltip control itself. By checking the structure of TOOLINFO, this kind of control has internal structure which stores the connect between itself and the owner window ( specified areas or sub controls).So I check the WM_NOTIFY message of the frame window. After some coding tests , nothing about tooltip come into WM_NOTIFY at all. Tooltip control has a TOP_MOST style to display the tooltip info and also it should be a window , so I use spy++ to enumerate all the windows with TOP_MOST style , from what I expected , some one may have the same value with frame window's instance or something else. After I tried several times , nothing found yet.
Yount_0701
21-Nov-22 22:43pm
View
Deleted
So far from what I know tooltip control messages have nothing to do with what I concern. They are internal messages for the tooltip control itself. By checking the structure of TOOLINFO, this kind of control has internal structure which stores the connect between itself and the owner window ( specified areas or sub controls).So I check the WM_NOTIFY message of the frame window. After some coding tests , nothing about tooltip come into WM_NOTIFY at all. Tooltip control has a TOP_MOST style to display the tooltip info and also it should be a window , so I use spy++ to enumerate all the windows with TOP_MOST style , from what I expected , some one may have the same value with frame window's instance or something else. After I tried several times , nothing found yet.
Yount_0701
21-Nov-22 6:24am
View
Msdn shows the operation on tooltip control. What makes me confused was, the standard main window should have a tooltip control, How can I get the HWND of this tooltip ?
Msdn code creates a brand new tooltip control, using a global variable to record the HWND of the tooltip, But The original tooltip for the Non-client maximizing/minimizing/closing areas , where is it ? How to use it ?
Yount_0701
9-Oct-22 8:22am
View
Deleted
I have to admit that the variable nIDEvent should be initialized with a specified event value which I missed in my codes.
I have tried your idea before I posted this question. Frankly It does not work as I expected, which crashed at the explicit conversion.
Some articles show a different way of catching the message loop by interfering the message translating and distributing. It's just not what I want.
Yount_0701
9-Oct-22 8:22am
View
I have to admit that the variable nIDEvent should be initialized with a specified event value which I missed in my codes.
I have tried your idea before I posted this question. Frankly It does not work as I expected, which crashed at the explicit conversion.
Some articles show a different way of catching the message loop by interfering the message translating and distributing. It's just not what I want.
Yount_0701
11-Sep-22 6:21am
View
Thank you.
I'm waiting for some kind of breakthrough.
Yount_0701
3-Sep-22 6:53am
View
you're right. It maybe depends on compliers. MSVC works OK.
Yount_0701
3-Sep-22 6:37am
View
great! I believe your code is the right way which I ever saw in some open source code though scratching in my mind but forgot the exact coding details.
Some open source code or some interface provided by supplier may not want to expose the details of their implementations to the third part users, they do not open the structure members but just provide a method to access the members, there are many pre-declarations about the structure pointer in their open head files. They usually use your way! A good way.
Thank you @markkuk
Yount_0701
9-Nov-21 4:02am
View
spy++ doesn't work. I give up.
Yount_0701
19-Sep-18 8:02am
View
I tried your code , it just not work.Is there anything wrong ?
Yount_0701
19-Sep-18 5:16am
View
According to MSDN:
"EM_FINDTEXTEX message
Finds text within a rich edit control.
...
Return value
If the target string is found, the return value is the zero-based position of the first character of the match. If the target is not found, the return value is -1."
here for some reason i have to user win32 message EM_FINDTEXTEX rather then the wrapped class method FindText.
please focus on the reason why result equals -1.
thank you anyway
Yount_0701
21-Jun-18 3:52am
View
I understand what you said here.Standard win32 application depends on Windows message loop.The windows platform is driven by windows message.I use the spy++ to follow the normal operation on this TDBGrid control,the messages are not standard WM_ messages , all belong to self-defined messages.
retrive the information of the control means to review the implement source code(by pascal),not a choice
is there any other way ?
Yount_0701
20-Jun-18 9:20am
View
you mean to rewrite the notepad wndproc of dealing with WM_CHAR message?
Yount_0701
20-Jun-18 9:19am
View
That's true. the saving operation pop out the dialog , I chose the utf-16 encoding.
But I'm not sure what you mean "WM_CHAR expects a Unicode character in the wParam paremeter." I use binary 0xbac3,that should be a unicode WORD,but the view on notepad makes me confused,it's just some random symbols.
Yount_0701
20-Jun-18 9:19am
View
that's true. the saving operation pop out the dialog , I chose the utf-16 encoding.
But I'm not sure what you mean "WM_CHAR expects a Unicode character in the wParam paremeter." I use binary 0xbac3,that should be a unicode WORD,but the view on notepad makes me confused,it's just some random symbols.
Yount_0701
20-Jun-18 3:59am
View
In fact what I'm really concern is the access of the control info,standard win32 controls like listbox can easily get the column items info , also the row items. But not VCL.
Yount_0701
20-Jun-18 3:49am
View
SendInput is ok, here i submit some code:
#include <afx.h>
void SendAscii(wchar_t data, BOOL shift);
void SendUnicode(wchar_t data);
void SendKeys(CString msg);
void SendAscii(wchar_t data, BOOL shift)
{
INPUT input[2];
memset(input, 0, 2 * sizeof(INPUT));
if (shift) {
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = VK_SHIFT;
SendInput(1, input, sizeof(INPUT));
}
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = data;
input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = data;
input[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(2, input, sizeof(INPUT));
if (shift) {
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = VK_SHIFT;
input[0].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, input, sizeof(INPUT));
}
}
void SendUnicode(wchar_t data)
{
INPUT input[2];
memset(input, 0, 2 * sizeof(INPUT));
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = 0;
input[0].ki.wScan = data;
input[0].ki.dwFlags = 0x4;//KEYEVENTF_UNICODE;
input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = 0;
input[1].ki.wScan = data;
input[1].ki.dwFlags = KEYEVENTF_KEYUP | 0x4;//KEYEVENTF_UNICODE;
SendInput(2, input, sizeof(INPUT));
}
void SendString(CString msg)
{
short vk;
BOOL shift;
USES_CONVERSION;
wchar_t* data = T2W(msg.GetBuffer(0));
int len = wcslen(data);
for(int i=0;i<len;i++)
{
if (data[i]>=0 && data[i]<256)
{ //ascii charactor
vk = VkKeyScanW(data[i]);
if (vk == -1) SendUnicode(data[i]);
else
{
if (vk < 0) vk = ~vk + 0x1;
shift = vk >> 8 & 0x1;
if (GetKeyState(VK_CAPITAL) & 0x1) {
if (data[i]>='a' && data[i]<='z' || data[i]>='A' && data[i]<='Z')
{
shift = !shift;
}
}
SendAscii(vk & 0xFF, shift);
Sleep(100);
}
}
else //unicode
{
SendUnicode(data[i]);
Sleep(100);
}
}
}
Show More