I am developing a service for a client, and must display a system-modal message box from the service. I would like my message box to look similar to other notifications displayed by the system (e.g. low power notifications, Windows Update notifications, etc.)
I can display an message box from the service in the standard Windows format. Is there an API to display windows in this format, or must I write it myself?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
When I search on the Internet, I find millions of web pages explaining how to check if a .exe-file is running, from within a .bat-file. However, I can't find a single page explaining what to do if you have several .exe-files with identical names and you only want to check an .exe-file that resides in a specific folder. Can anybody please help me, what's the way to detect if the file C:\MyProject\bin\release\MyApplication.exe is running, but at the same time completely ignore C:\MyProject\bin\debug\MyApplication.exe?
for /f "usebackq tokens=* delims=" %%a in (`
wmic process where 'CommandLine like "%%!workdir!%%" and not CommandLine like "%%RuntimeBroker%%"' get CommandLine^,ProcessId /format:value
`) do (
for /f "tokens=* delims=" %%G in ("%%a") do (
if"%%G" neq "" (
rem echo %%G
rem echo !ProcessId!
echo The application is not running
echo The application is running
Greetings to everyone. On my Windows 10 PC, I use Avast AV for an extra layer of protection on Windows Defender. But with the installation of Avast AV, the Avast Secure browser was installed. I don't really use it, so if I uninstall Avast Secure Browser, will it cause any problems with Avast AV on my PC? Please, give me some suggestions about this. Any kind of reply would be greatly appreciated.
In playing around with some basic GDI stuff, I had the need to draw an object in the middle of the main window and then when a button is clicked, draw that object progressively closer to some corner (in my code below, the object moves to the lower right corner, but ultimately I'd like it to move to any corner). So my question is: how to calculate those new X/Y coordinates with each button click?
The initial X/Y coordinates are calculated in response to WM_SIZE like:
nScreenWidth = LOWORD(lParam);
nScreenHeight = HIWORD(lParam);
// the window is not being resized right now, so these two variables aren't being recalculated.
nX = (nScreenWidth - nObjectWidth) / 2;
nY = (nScreenHeight - nObjectHeight) / 2;
When the button is clicked, new X/Y coordinates are "calculated" like:
if (LOWORD(wParam) == ID_BUTTON)
nX += 20;
nY += 10;
InvalidateRect(hWnd, NULL, TRUE);
The object is drawn in response to WM_PAINT like:
HDC hdc = BeginPaint(hWnd, &ps);
// draw object at nX, nY
You can count on one hand how many GDI projects I've done in the past (and have fingers left over) so I'm walking in somewhat uncharted territory for me. As a visual aide, if you envision a straight line drawn from the middle of the screen to one of its corners, each pixel of that line is on an X/Y coordinate. What would that calculation look like?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
I don't think it is a straightforward calculation as you would need to move more pixels in the horizontal direction than the vertical (assuming landscape view). If you use GDI+ it is slightly easier as you can use float values for the points and Windows does the smoothing. But I am not 100% clear as to the actual problem. And incidentally, as far as handling messages and repainting, your code all looks correct.
Here is a very simple method of moving the box:
You need to start by calculating the value of the slope ratio between horizontal and vertical size of the Window's client area. You need this as a floating point value as it will be used to calculate positions further on.
Declare a static float value named slopeRatio, and add the following code to either the initialisation (e.g. WM_CREATE), or whenever the Window is resized (WM_SIZE).
// get the slope of the client area diagonal
float horiz = (float)rcClient.right; // Horizontal width in pixelsfloat vert = (float)rcClient.bottom; // Vertical height in pixels
slopeRatio = horiz / vert;
Then when you need to calculate the new X and Y positions of your drawing (after the button press) do the following:
// currentX and currentY are declared elsewhere
currentX += 30; // or whatever value you wish to move it
tempY = (float)currentX / slopeRatio;
currentY = (int)tempY;
InvalidateRect(hWnd, nullptr, TRUE);
so, i was doing some programming with eclipse and stuff. But then i noticed that all of my .JAR files suddenly looked like a pinguin with some painting stuff on his hands. i need help, cause im not sure what is going on!! I use windows.
[SOLVED] I had to right click a JAR file, and "press open in application" then select Java JDK. For some reason i had two of those...