Valhalla Legends Forums Archive | General Programming | Paste macros and subclassing

AuthorMessageTime
St0rm.iD
I'm new to the Win32 api.

When I'm coding I've found that I have to paste a lot of similar code multiple times, perhaps changing one or two things in each piece of code. I've though of an idea. Perhaps, if you copy text that looks like: macro:echo %USERNAME%, every time you paste, an inputbox would come up and be like "Enter value for USERNAME". I have a feeling I'm going to have to subclass a textbox or something but I don't know how to start.

I have an idea of how to implement it, but I have to intercept copy messages and paste messages for certain controls inside remote processes. Any ideas?

I can write C/C++, Delphi, VB, Java, Python, Psuedo, whatever you throw at me I can use. Thanks.
August 27, 2003, 8:37 PM
Skywing
[quote author=St0rm.iD link=board=5;threadid=2477;start=0#msg19329 date=1062016667]
I'm new to the Win32 api.

When I'm coding I've found that I have to paste a lot of similar code multiple times, perhaps changing one or two things in each piece of code. I've though of an idea. Perhaps, if you copy text that looks like: macro:echo %USERNAME%, every time you paste, an inputbox would come up and be like "Enter value for USERNAME". I have a feeling I'm going to have to subclass a textbox or something but I don't know how to start.

I have an idea of how to implement it, but I have to intercept copy messages and paste messages for certain controls inside remote processes. Any ideas?

I can write C/C++, Delphi, VB, Java, Python, Psuedo, whatever you throw at me I can use. Thanks.
[/quote]
Take a look at the SetClipboardViewer function. Basically, it allows you to register to be notified whenever the clipboard contents change. You could try scanning the clipboard for plaintext datatypes and then expanding variables as necessary whenever the clipboard contents change. This would nicely eliminate issues with messing around with other process address spaces, something the end-user might not have permissions to do conveniently anyway (i.e. most users can't debug arbitrary processes, and generally can't set hooks on processes owned by other accounts, such as interactive LocalSystem services).
August 27, 2003, 8:58 PM
Camel
I had a friend who once copied something on his laptop and tried to paste on his desktop. It's okay though, he was a mac user. :)
August 27, 2003, 9:07 PM
Adron
[quote author=Camel link=board=5;threadid=2477;start=0#msg19336 date=1062018454]
I had a friend who once copied something on his laptop and tried to paste on his desktop. It's okay though, he was a mac user. :)
[/quote]

I wonder when they will fix that. It would make a lot of sense for a single user to have a shared clipboard on all computers.
August 27, 2003, 9:57 PM
Adron
[quote author=St0rm.iD link=board=5;threadid=2477;start=0#msg19329 date=1062016667]
every time you paste, an inputbox would come up and be like "Enter value for USERNAME". I have a feeling I'm going to have to subclass a textbox or something but I don't know how to start.
[/quote]

If you can accept storing your macros in a specific application (some kind of palette), then you could just put a handle on the clipboard and respond to WM_RENDERFORMAT by doing that inputbox...
August 27, 2003, 10:06 PM
Grok
[quote author=Adron link=board=5;threadid=2477;start=0#msg19346 date=1062021474]
[quote author=Camel link=board=5;threadid=2477;start=0#msg19336 date=1062018454]
I had a friend who once copied something on his laptop and tried to paste on his desktop. It's okay though, he was a mac user. :)
[/quote]

I wonder when they will fix that. It would make a lot of sense for a single user to have a shared clipboard on all computers.
[/quote]

Works across Terminal Server client sessions.
August 28, 2003, 1:16 AM
St0rm.iD
<ot>
Eventually I foresee computers will organize themselves into virtual computers, which are P2P networks which spread processing load and offer a shared, virtual everything (drive, clipboard, processes, network interface, etc).
</ot>

Skywing, i'll look into that, it seems the easiest way.
August 28, 2003, 4:42 AM
Camel
[quote author=St0rm.iD link=board=5;threadid=2477;start=0#msg19359 date=1062045728]Eventually I foresee computers will organize themselves into virtual computers, which are P2P networks which spread processing load and offer a shared, virtual everything (drive, clipboard, processes, network interface, etc).[/quote]

Check out Virutal PC; it started as a PC (ix86) emulator for Mac OS, but was comically ported to the PC (Windows and Linux versions are availible). It has grown a lot, and now is supported and even used by Microsoft. It allows a single host machine to run multiple virtual ix86 environments -- the antitisis of what you were talking about, but it is certainly a step in the right direction to distributed virtual computing.
August 28, 2003, 7:22 AM
Adron
[quote author=Grok link=board=5;threadid=2477;start=0#msg19357 date=1062033418]
[quote author=Adron link=board=5;threadid=2477;start=0#msg19346 date=1062021474]
I wonder when they will fix that. It would make a lot of sense for a single user to have a shared clipboard on all computers.
[/quote]

Works across Terminal Server client sessions.
[/quote]

Well, it wouldn't be all that hard to implement a little application you ran just like rdpclip that distributed your clipboard contents between all the computers that you are logged on to. Actually I seem to recall a similar application in Windows 3.1, that shared clipboards over some netbios thing?
August 28, 2003, 6:20 PM
Noodlez
when i was like 11 i saw something on the news where bill gates was demonstrating windows ME... he had 2 computers networked and dragged a window from one computer into the other computer. i'm positive it wasn't just 2 monitors attached to one machine because both of them had desktops and start menu buttons (if it was 2 monitors there would only be one start menu button and the bar would be streched)

to this day i have no fucking idea how that was done.

any insight?
August 29, 2003, 12:13 AM
St0rm.iD
X?
August 29, 2003, 3:56 AM
Camel
[quote author=Noodlez link=board=5;threadid=2477;start=0#msg19403 date=1062115990]
when i was like 11 i saw something on the news where bill gates was demonstrating windows ME... he had 2 computers networked and dragged a window from one computer into the other computer. i'm positive it wasn't just 2 monitors attached to one machine because both of them had desktops and start menu buttons (if it was 2 monitors there would only be one start menu button and the bar would be streched)

to this day i have no fucking idea how that was done.

any insight?[/quote]

Who told you you can't have two start menus?
August 29, 2003, 5:53 AM

Search