|
If you create a child window of a dialog, usually a control, the HMENU field is a resource identifier so you actually do have them since controls generally do not have menus. This is true of both CreateWindow and CreateWindowEx and the identifiers have to be unique for all controls in a dialog.
ETA: there is a handy function, GetDlgItem, that will give you a handle to a control in a dialog. It is handy because if you use it then you don't have to save handles to the controls.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
Right, and I set them to negative numbers so that if i ever do add resources they won't collide.
Guess I stated things poorly.
The documentation however, isn't geared for doing it this way, so things get a bit iffy especially since all the example code is with loading resources.
It's doable, it's just taking me longer than I otherwise would.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Dive into my code more deeply. I'm not at my desk now, but each control automatically gets assigned a unique ID for that purpose. Maybe my WinControl unit shines a light on it somehow. I think it contains an object that gets the ID during construction. I mention it in some article somewhere. If you want more details it will have to wait until late tonight when I get off shift.
|
|
|
|
|
Here's what I do - because I only need to do this for dynamic menus:
Of note is this: mif.wID = (~i); which yields a negative ID I can reconstitute into a gpio id by repeating the ~ operator on it.
static void update_gpios() {
updating_gpios = true;
while(GetMenuItemCount(gpio_menu)) {
RemoveMenu(gpio_menu,0,MF_BYPOSITION);
}
wchar_t name[256];
for(size_t i = 0; i < 256; ++i) {
gpio_t& g = gpios[i];
if(g.mode!=0) {
wcscpy(name,L"GPIO ");
_itow((int)i,name+wcslen(name),10);
switch(g.mode) {
case INPUT:
case INPUT_PULLDOWN:
case INPUT_PULLUP:
wcscat(name,L" <");
break;
case OUTPUT:
case OUTPUT_OPEN_DRAIN:
wcscat(name,L" >");
}
MENUITEMINFOW mif;
mif.cbSize = sizeof(MENUITEMINFOW);
mif.cch = wcslen(name);
mif.dwTypeData = name;
mif.fMask = MIIM_STRING | MIIM_ID | MIIM_STATE;
mif.wID = (~i);
mif.fState = g.value==0?MFS_UNCHECKED:MFS_CHECKED;
InsertMenuItemW(gpio_menu,GetMenuItemCount(gpio_menu),TRUE,&mif);
}
if(g.hwnd_text!=NULL) {
wchar_t val[64];
if(!g.is_input()) {
if(g.value==HIGH) {
wcscpy(val,L"HIGH");
} else if(g.value==LOW) {
wcscpy(val,L"LOW");
} else {
_itow(g.value,val,10);
}
if(GetFocus()!=g.hwnd_text) {
SetWindowTextW(g.hwnd_text, val);
}
}
EnableWindow(g.hwnd_text,g.is_input()?TRUE:FALSE);
}
}
updating_gpios = false;
}
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Menus in Windows are a bitch. I believe the convoluted code behind the scenes may be the real reason MS went to ribbons. Maybe my WinMenu unit helps you - I don't know.
|
|
|
|
|
I've got it sorted now. I'm keeping this UI very vanilla. It's mostly just a shim to make Arduino work on a Windows machine so I don't need much.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Ps - maybe the WinCallbackItem unit helps.
|
|
|
|
|
You remind me old times... And make me wonder why would I do that as today...
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization." ― Gerald Weinberg
|
|
|
|
|
Coding a windows app in GCC. I don't even want to try to get MFC to compile with it.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
I'm working in GCC, which is a requirement for this project.
As such, I can't necessarily use things like MFC as I'm not sure their headers will compile with GCC. I haven't tried, honestly but see, because even if I did, I lack the resource editor needed to visually lay out the controls, not using visual studio.
So I'm kind of stuck with what I have.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Use Resource Hacker: Resource Hacker
It'll create the RC fles as per normal, or you can get it to spit out the C code for creating a drawn dialog.
It's what I use whenever I'm doing windows stuff with gcc.
Here's one of the lines during the build:
windres.exe -J rc -O coff -i C:\Users\enhzf\DOCUME~1\code\GALLER~1\resource.rc -o obj\Debug\galleryPreview\resource.res
Can't remember the linking one, and unfortunately, this project won't build on this machine yet.
EDIT: still won't build, but I got it to spit out the linking line. Nothing special - just include the res file.
g++.exe -o bin\Debug\galleryPreview.exe obj\Debug\cStaticLink\cStaticLink.o obj\Debug\galleryPreview\main.o obj\Debug\galleryPreview\network.o obj\Debug\galleryPreview\resource.res -lgdi32 -luser32 -lkernel32 -lcomctl32 -lws2_32 -lOle32 -lwinmm
|
|
|
|
|
Oh wow, thank you!
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Hello,
I feel quite lost...
New laptop (bought this spring) using Windows 11 Pro with MS 365, however I guess I didn't have to install MS Teams at the beginning as I already had it.
In the first weeks, everything worked well, but ... suddenly:
- MS Teams seems have turned into a chat-only application.
No phone calls therein.
No camera connected although I do have one!
Cannot even join an invitation I sent...
- But I need a video-chat application.
- Best, some that works on Windows 11 and lets people with Mac/Linux join as I invite them
- For example for such useful and important things as online jobs interviews?
What has happened to MS Teams? How can I fix this?
Any ideas?
|
|
|
|
|
|
Apparently, MS Teams has "back doors". It may be a work in progress.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
I lose sound or video in MS Teams whenever my laptop sleeps. Rebooting fixes it though (and now I use hibernate before I unplug my laptop so it doesn't sleep).
|
|
|
|
|
So, what happens when you try to reinstall it? https://teams.microsoft.com has a "Get the Windows app" button to download the native Win32 EXE.
Failing that, I'd be surprised if the web client didn't work. And frankly I don't see much difference between it and the EXE.
|
|
|
|
|
The web client is apparently prompting me to install the app (which is, although I do have Teams app...)
All of that redirects me to https://teams.live.com/_#/unsupportedBrowser[^]
My Teams app differs from the 2021 version of Teams shown in picture here Redirecting[^] in that mine only shows: Activity, Community, Chat, Calendar. No "Meetings", "Calls", "three dots menu". So I must have a newer version of MS Teams than that in the link below. However I cannot find a version number anyhow 
|
|
|
|
|
Sounds like your trial period ended and you need to buy a license.
|
|
|
|
|
Well, but... I didn't get any period-ending reminder or notice beforehand. This keeps on puzzling me more and more...
|
|
|
|
|
The Teams that ships with Windows 11 is really just a chat application and should be uninstalled if you want the full Teams. What you're looking for is Microsoft Teams (Work or School) and you can download it from https://teams.microsoft.com (assuming you have a M365 Teams account that includes Teams).
|
|
|
|
|
I have M365 account, as I buy "
Microsoft 365 Family " for every 12-15 months. However, that sounds different than "M365 Teams account" which I don't know at all.
Teams (Work or School) perhaps requires me to have a company's or a school's e-mail address. But I don't have such an e-mail address so far...
|
|
|
|
|
Hi All,
Time for a rant, I know how to get PC's to talk to the outside world given sufficient hardware and info. I am playing with a set of scales that we are abusing for a test rig. The device is a little odd and the timing of it is strange. You send it a 'Z\r\n' to zero it 'beep' (which according to the docs means received & understood) and period of time T it zero's, then reading is made via 'P\r\n' 'beep' and the reading is returned. The reading packet seems to hold the current tare weight, the number of readings made and a total. All we care about is the tare weight. If the unit is zeroed the tare weight according to logic should be 0.00 but no it is not there?? force a zero by the on scale function it returns a 0.00 tare weight? Combined with the lack of Vis Studio .NET beyond version 2003 (.NET 1.5??) means I have to make notes of how the software behaves and do the mods with 2008 all despite having the OK for a new version (2017 possibly needed for compatibility issues) I still don't have it. I'm doing my best with what I have (if some else tells me to use Python I will stick a fork in their eye)
Glenn
|
|
|
|
|
What I normally do is to use a terminal emulation program to send commands "by hand" and see what's going on. If I have to spy on two devices talking serially, I use two COM ports to capture each side of the dialog.
Mircea
|
|
|
|
|
That was my first though but I haven't done to much serial port work since Win 8, Win10 & Win11 I have not attacked in the same depth. The blessed tool I used to use won't work on Win11 (I also don't have Admin so problems!)
|
|
|
|