KwikStrip rewrite
Moderator: BioHazard
- BioHazard
- Posts: 408
- Joined: Mon Jul 25, 2005 10:02
- Location: Middle of California where there is no air.
- Contact:
I have tried to figure out hotkeys but my tests have never worked. If someone wants to give me a C way to do hotkeys I'd be very much obliged.
If you can get the KwikStrip window in focus, you can open/close it with space.
I was asking about the dragging stuff because I'm going to rewrite KwikStrip again. The current version is extremly hacky but I know how to fix that now (using code from ZDL). I would keep the drawing functions though, as they are fine.
If you can get the KwikStrip window in focus, you can open/close it with space.
I was asking about the dragging stuff because I'm going to rewrite KwikStrip again. The current version is extremly hacky but I know how to fix that now (using code from ZDL). I would keep the drawing functions though, as they are fine.
-
- Posts: 22
- Joined: Sun Nov 13, 2005 23:18
I can write a program to send a message to KwickStrip whenever a key combination is pressed. Actually, I might be able to merge the hook and KwikStrip together, but I'm not entirely sure. Hooking is a complex process. I have made programs the responded to hotkeys. Basically I told (XP!) that I wanted to listen in on what keys were pressed, and then I just filtered the keys I wanted. (Remember AccountLockout anybody? WinkeyLogout or something like that used this tech.)
EDIT: Is also "Stay on top" an option? I'd actually use if it had that. Actually, if it did the hotkey thing, I'd use it.
EDIT: Is also "Stay on top" an option? I'd actually use if it had that. Actually, if it did the hotkey thing, I'd use it.
- BioHazard
- Posts: 408
- Joined: Mon Jul 25, 2005 10:02
- Location: Middle of California where there is no air.
- Contact:
Always on top is an option in the latest alpha.
I'm reading the MSDN page on WM_SETHOTKEY again. See if I missed something the last 5 times I read it.
EDIT: Problem solved:
I'm reading the MSDN page on WM_SETHOTKEY again. See if I missed something the last 5 times I read it.
EDIT: Problem solved:
Code: Select all
LRESULT CALLBACK MainProc(HWND dlg,UINT msg,WPARAM wp,LPARAM lp){
switch(msg){
case WM_CREATE:RegisterHotKey(dlg,1,MOD_CONTROL|MOD_ALT,'K');break;
case WM_HOTKEY:SetForegroundWindow(dlg);break;
case WM_CLOSE:PostQuitMessage(0);break;
}return DefWindowProc(dlg,msg,wp,lp);
}
-
- Posts: 20
- Joined: Wed Jul 06, 2005 14:04
- Location: Oxford, PA
Wow, you have an... intresting programming style Bio.
I would have done it:
For the sake of legibility.
I would have done it:
Code: Select all
LRESULT CALLBACK MainProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) {
switch(msg)
{
case WM_CREATE:
RegisterHotKey(dlg, 1, MOD_CONTROL | MOD_ALT, 'K');
break;
case WM_HOTKEY:
SetForegroundWindow(dlg);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
}
return DefWindowProc(dlg, msg, wParam, lParam);
}
Last edited by killingblair on Thu Jan 26, 2006 22:37, edited 1 time in total.
- DoomRater
- Posts: 397
- Joined: Tue Jul 19, 2005 4:14
- Location: Programmer's Room, talking to Will Harvey
- Contact:
Normally C code has each command written on each line.
To be honest though I like Bio's code much more.
Code: Select all
LRESULT CALLBACK MainProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
RegisterHotKey(dlg, 1, MOD_CONTROL | MOD_ALT, 'K');
break;
case WM_HOTKEY:
SetForegroundWindow(dlg);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
}
return DefWindowProc(dlg,msg,wp,lp);
}
- TheDarkArchon
- Posts: 1000
- Joined: Wed Jul 06, 2005 11:58
- Location: What's that fucking smell
- Contact:
- DoomRater
- Posts: 397
- Joined: Tue Jul 19, 2005 4:14
- Location: Programmer's Room, talking to Will Harvey
- Contact:
- BioHazard
- Posts: 408
- Joined: Mon Jul 25, 2005 10:02
- Location: Middle of California where there is no air.
- Contact:
- Enjay
- Developer
- Posts: 4723
- Joined: Tue Aug 30, 2005 23:19
- Location: Scotland
- Contact:
- DoomRater
- Posts: 397
- Joined: Tue Jul 19, 2005 4:14
- Location: Programmer's Room, talking to Will Harvey
- Contact:
- BioHazard
- Posts: 408
- Joined: Mon Jul 25, 2005 10:02
- Location: Middle of California where there is no air.
- Contact:
Make fun of Bio's code!
Leson 2:
Leson 2:
Code: Select all
////////////////////////////////////////////////////
// Strip_OpenClose : Opens and closes the strip (duh)
void Strip_OpenClose(){
signed short i=(vr.open)?vr.rct.x:vr.rct.x+(vr.rct.w-mx.arww);
signed short dest=(vr.open)?vr.rct.x+(vr.rct.w-mx.arww):vr.rct.x;
signed char step=(vr.open)?(mx.btnw/4):(-(mx.btnw/4));
if(cfg.anim){ // only animate if animation is turned on
for(i;(vr.open)?i<=dest:i>=dest;i+=step){
SetWindowPos(vr.strip,0,i,vr.rct.y,(vr.rct.w+vr.rct.x)-i,vr.rct.h,SWP_NOZORDER);
UpdateWindow(vr.strip);
Sleep(1);
}
}SetWindowPos(vr.strip,0,dest,vr.rct.y,(vr.open)?mx.arww:vr.rct.w,vr.rct.h,SWP_NOZORDER);
vr.open=(vr.open)?(0):(1);
SendMessage(vr.arw,WM_PAINT,0,0); // Change the arrow position
}
- TheDarkArchon
- Posts: 1000
- Joined: Wed Jul 06, 2005 11:58
- Location: What's that fucking smell
- Contact:
- BioHazard
- Posts: 408
- Joined: Mon Jul 25, 2005 10:02
- Location: Middle of California where there is no air.
- Contact:
- DoomRater
- Posts: 397
- Joined: Tue Jul 19, 2005 4:14
- Location: Programmer's Room, talking to Will Harvey
- Contact:
- BioHazard
- Posts: 408
- Joined: Mon Jul 25, 2005 10:02
- Location: Middle of California where there is no air.
- Contact:
Inline conditionals! \o/
(condition)?(true):(false)
So basically,
is a quicker way of saying
The cool thing about inline conditionals is you can put them in the middle of a function call. For example
This would pass 1 to the function if btn.dwn is true and 0 otherwise.
(condition)?(true):(false)
So basically,
Code: Select all
vr.open=(vr.open)?(0):(1);
Code: Select all
if(vr.open){
vr.open=0;
}else{
vr.open=1;
}
Code: Select all
Dlg_ChangeButtonState(btn.dwn?1:0);
Last edited by BioHazard on Sun Feb 05, 2006 22:43, edited 1 time in total.