|
Is there a way to enable hicolor when using LoadToolBar? I dont want to create the tool bar from code.
|
|
|
|
|
Use LoadToolBar first - it'll assign command IDs to buttons. Then, call the routine I've posted to change images to hicolor.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
See following article -
http://www.codeproject.com/docking/toolbar_hotbuttons.asp
|
|
|
|
|
Hi,
I wanna implement child windows in a Win32-Application (not using MFC). Works fine, but there's a problem with the focus: in apps like Photoshop, the tool windows stay "blue", i.e. they dont get deactivated when clicking anywhere else in the main window. Also, when clicking in one of these tool windows, the main window doesnt get deactivated, and they are floating, so they are no overlapped windows. Any ideas how to implement this?
|
|
|
|
|
Handle WM_NCACTIVATE to avoid color changes in title bar.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thanks.
Oh man, its THAT easy.
I really should learn to search the MSDN with better keywords.
*doh* =)
|
|
|
|
|
I need to dynamically create a mask from a full color bitmap. How would you go abouts doing this...?
I have an idea...but i'm curious if there is a easier approach...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Create a one bit bitmap and ( from memory ) make the colour you wat to be black the background colour, then blt onto it. There's an article in MSDN, and it's something like that. It's part of how to create transparency masks on the fly. The WDJ site has code to do it from my Sept 2001 article, but it's been ages since I did anything like that, so I'm not entirely sure of the details.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Thats sorta what I had in mind.
I figure i'll use the first pixel as the background...and basically floodfill the entire backgrond with a unique color not used in the image. Then replace any color that doesn't match the background with black.
There are assumtions with this method, but overall it should work eh...?
Thanx Christian..
p.s-If it's an old article will it still be there on msdn...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Thomasz has given you the MSDN articles I was thinking of, but I was saying I used the same method in a WDJ article I wrote. It's on the WDJ site, not in the MSDN
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian Graus wrote:
Thomasz has given you the MSDN articles
Actually, I'm Tomasz without the 'h'.
Anyway, being in one pack with Petzold feels great
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
*grin* you know, I originally didn't get the Petzold reference ( I assumed he wrote the MSDN articles ), then I thought of it myself and finally put together your comment.
Sadly my thought processes when coding are often this convoluted also :P
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
What's the criteria for creation of the mask? Do you want all pixels with given color to be RGB(0, 0, 0) in the mask, RGB(255, 255, 255) otherwise?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
I think I figured it out.
i'll assume the first pixel in the bitmap is the background and I will floodfill the back with a unique color. then replace each non-background color pixel with black and I should have a dynamic mask...?
There are some assumtions being made, but I think it'll work for me.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
There are some assumtions being made, but I think it'll work for me.
FloodFill - slow and won't work when you have background areas surrounded by non-background.
'Replacing each non-background color pixel' - very slow, assuming that you want to iterate over bitmap with GetPixel.
Basically, you need to BitBlt to monochrome bitmap having text color and background color set to appropriate values. I can't give you any more advice on this - trade secrets, you know But I'm sure CG will be happy to provide you with the details.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Tomasz Sowinski wrote:
Basically, you need to BitBlt to monochrome bitmap having text color and background color set to appropriate values
If i blit(24bit) to a monochrome bitmap it'll do everything for me...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
The keys to nirvana: Q79212, Q149585. Follow the white rabbit
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Tomasz Sowinski wrote:
Follow the white rabbit
Haven't seen many expoits of The Matrix, so thought I would point this out.
Nick Parker
|
|
|
|
|
Thanx you muchly i'll check it out!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I´m writing a program that have a registration form, where the user needs to inform a registration code (that varies from machine to machine). He must contact the company to obtain the reg code, otherwise he will run the program for a short period of time only. The problem is that as a windows c++ programmer I know that is pretty easy to create a brute force program that keep trying to guess the correct registraton code. I´ve implemented some code to prevent that from happening... but I want to ask the opinion of you guys to see if you have a different idea for this implementation than mine. My idea prevents the user from using the app forever. How do you guys would implement this ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
My latest article:
Pentominos - A C# implementation of the famous Puzzle Game
|
|
|
|
|
I once thought the same thing.
I figured I could write a quick and dirty util to enumerate/iterate..??? each possible alpha-numeric password, reg code in the book.
At first I thought this is easy...but after alot of thought and some research I concluded...programs that use 128 bit encrytpion or product keys do it for a known reason.
128 bit is a massive number:
18446744073709551616 unless i missed something...
For a program to try each of the possible keys would require some time even if your hardcoded the algorithm into your attack code.
The way I see it, even if you code a 3 try limit, then fail...
If someone gains knowledge of your algorithm and maybe a database or something, they could code a highly optimized version and maybe reduce time required a little, but nothing substantial.
Where there is a will, there will always be a way!!!
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
18446744073709551616 unless i missed something...
Don't want to sound picky, but that's a 64-bit value.
8-bit: 256
16-bit: 65,536
32-bit: 4,294,967,296
64-bit: 18,446,744,073,709,551,616
128-bit: ~3.4028236692093846346337460743e+38
I would've been more precise but the calc I'm using sucks. I let my cousin borrow my Text Instruments calc way back when and it has mysteriously dissappeared.
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
Homepage: imputek.com
|
|
|
|
|
Make the code long enough.
Say 12 characters.
That should take several months to bruteforce.
Nish
I am the Keyboard Smasher
|
|
|
|
|
Crackers do not use brute force. They're using kernel debuggers like SoftICE to get insight into your software. So you have to be quite smart and make them tired during this process to avoid creation of patches. And, for God's sake, *do not* put statements like this in your code:
if (daysSinceInstall > 7)
{
MessageBox("Money makes the world go round");
return;
}
because it's super-easy to find/remove the test.
OTOH, you can avoid pirated key generators if you go for strong encryption, like RSA.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Don't most serious software packages use some form of encryption...?
This makes it absolutely nessecary to brute force attack. Unless i'm missing something here???
If you try and protect your code by hardcoding the protection scheme into your exe, like your code snippet above, it's (can be) easy to dissassemble change whats stopping you from using the full package and re-assemble.
The above can be accomplished with a binary search and replace utility, i've done it.
I always thought(or starting too) that programs now incorporate some form of encryption, because then disassembly doesn't do anything and a brute force attack is required, thus the 128 bit thing...takes forever...
IMO there is NOTHING anyone can currently do to prevent the determined from hacking(you call it cracking and I know thats the proper term)any software. So ultimately...
if(DaysLeft == 7)
would suffice under most circumstances. Even if you have the know how to search for a BYTE,WORD, LONG and replace the value with something else...it's pretty tricky finding it and only the determined know-how individuals will try it.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|