KwikStrip rewrite

Stuff you want Bio to see. [Home]

Moderator: BioHazard

User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

Post by BioHazard » Sun Jan 22, 2006 23:32

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.

QBasicer
Posts: 22
Joined: Sun Nov 13, 2005 23:18

Post by QBasicer » Mon Jan 23, 2006 1:51

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.

User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

Post by BioHazard » Mon Jan 23, 2006 4:20

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:

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);
}

killingblair
Posts: 20
Joined: Wed Jul 06, 2005 14:04
Location: Oxford, PA
Contact:

Post by killingblair » Tue Jan 24, 2006 22:38

Wow, you have an... intresting programming style Bio. ;)

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);
}
For the sake of legibility. :P
Last edited by killingblair on Thu Jan 26, 2006 22:37, edited 1 time in total.

User avatar
DoomRater
I wanna get stuck in with da code
Posts: 397
Joined: Tue Jul 19, 2005 4:14
Location: Programmer's Room, talking to Will Harvey
Contact:

Post by DoomRater » Wed Jan 25, 2006 14:12

Normally C code has each command written on each line.

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); 
} 
To be honest though I like Bio's code much more.

User avatar
TheDarkArchon
Damn right I'm mighty.
Posts: 1000
Joined: Wed Jul 06, 2005 11:58
Location: What's that fucking smell
Contact:

Post by TheDarkArchon » Wed Jan 25, 2006 16:00

I'll quote Graf here: Compilers have optimizers for a reason.

User avatar
DoomRater
I wanna get stuck in with da code
Posts: 397
Joined: Tue Jul 19, 2005 4:14
Location: Programmer's Room, talking to Will Harvey
Contact:

Post by DoomRater » Wed Jan 25, 2006 20:34

To me it seems that those three pieces of code belong on the same line, since they're all related to each other. It's like wiritng a paragraph.

User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

Post by BioHazard » Fri Jan 27, 2006 13:09

I was working on KS2.5 and I got bored.

http://biohazard.drdteam.org/temp/blob.zip

User avatar
Enjay
There is no dark side in the moon, really...
Developer
Developer
Posts: 4589
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay » Fri Jan 27, 2006 13:42

He he, thanks. That was a real PIA on my mainly black desktop. ;)

User avatar
DoomRater
I wanna get stuck in with da code
Posts: 397
Joined: Tue Jul 19, 2005 4:14
Location: Programmer's Room, talking to Will Harvey
Contact:

Post by DoomRater » Fri Jan 27, 2006 19:19

Might be useful to help decorate a Serenade desktop... sinc Serenade don't have any desktop icons to cover.

User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

Post by BioHazard » Tue Jan 31, 2006 9:01

Make fun of Bio's code!

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
}

User avatar
TheDarkArchon
Damn right I'm mighty.
Posts: 1000
Joined: Wed Jul 06, 2005 11:58
Location: What's that fucking smell
Contact:

Post by TheDarkArchon » Tue Jan 31, 2006 10:19

I don't thing there is need to declare the integers as signed as they're signed by default (Well, it's like that in VC+, anyway)

User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

Post by BioHazard » Tue Jan 31, 2006 10:25

I just wanted to be absolutely sure they are signed, in case the default changes for some reason.

I also tend to go through my code and change things to unsigned 'cause I hardly ever do signed arithmetic. Hopefully seeing that I made them signed will stop me.

Just protecting it. :P

User avatar
DoomRater
I wanna get stuck in with da code
Posts: 397
Joined: Tue Jul 19, 2005 4:14
Location: Programmer's Room, talking to Will Harvey
Contact:

Post by DoomRater » Tue Jan 31, 2006 19:12

What's a Question Mark mean in C++? That's the only thing I don't really know.

User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

Post by BioHazard » Tue Jan 31, 2006 21:28

Inline conditionals! \o/

(condition)?(true):(false)

So basically,

Code: Select all

vr.open=(vr.open)?(0):(1);
is a quicker way of saying

Code: Select all

if(vr.open){
    vr.open=0;
}else{
    vr.open=1;
}
The cool thing about inline conditionals is you can put them in the middle of a function call. For example

Code: Select all

Dlg_ChangeButtonState(btn.dwn?1:0);
This would pass 1 to the function if btn.dwn is true and 0 otherwise.
Last edited by BioHazard on Sun Feb 05, 2006 22:43, edited 1 time in total.

Locked

Return to “Bio's Site-Place”

Who is online

Users browsing this forum: No registered users and 1 guest