• Welcome to Valhalla Legends Archive.
 

Paste macros and subclassing

Started by Banana fanna fo fanna, August 27, 2003, 03:37 PM

Previous topic - Next topic

Banana fanna fo fanna

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.

Skywing

Quote from: St0rm.iD on August 27, 2003, 03:37 PM
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.
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).

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. :)

Adron

Quote from: Camel on August 27, 2003, 04:07 PM
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. :)

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.

Adron

Quote from: St0rm.iD on August 27, 2003, 03:37 PM
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.

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...

Grok

Quote from: Adron on August 27, 2003, 04:57 PM
Quote from: Camel on August 27, 2003, 04:07 PM
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. :)

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.

Works across Terminal Server client sessions.

Banana fanna fo fanna

<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.

Camel

Quote from: St0rm.iD on August 27, 2003, 11:42 PMEventually 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).

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.

Adron

Quote from: Grok on August 27, 2003, 08:16 PM
Quote from: Adron on August 27, 2003, 04:57 PM
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.

Works across Terminal Server client sessions.

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?

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?


Camel

Quote from: Noodlez on August 28, 2003, 07:13 PM
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?

Who told you you can't have two start menus?