00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <basis/convert_utf.h>
00021 #include <basis/guards.h>
00022 #include <basis/istring.h>
00023 #include <basis/portable.h>
00024 #include <opsystem/command_line.h>
00025 #include <loggers/console_logger.h>
00026 #include <opsystem/filename.h>
00027 #include <data_struct/static_memory_gremlin.h>
00028
00029 HOOPLE_STARTUP_CODE;
00030
00031 window_handle matching_window = NIL;
00032 istring window_name_sought;
00033
00034 BOOL CALLBACK zingers_enum_proc(window_handle hwnd, LPARAM lParam)
00035 {
00036 const int MAX_TITLE = 1024;
00037 flexichar win_name[MAX_TITLE + 8];
00038 int chars = GetWindowText(hwnd, win_name, MAX_TITLE - 1);
00039 if (chars > 0) {
00040
00041 if (istring(from_unicode_temp(win_name)).ifind(window_name_sought) >= 0) {
00042 matching_window = hwnd;
00043 return false;
00044 }
00045 }
00046 return true;
00047 }
00048
00049 int main(int argc, char *argv[])
00050 {
00051 console_logger out;
00052 command_line cmds(argc, argv);
00053 if ( (cmds.entries() < 1)
00054 || (cmds.get(0).type() != command_parameter::VALUE) ) {
00055 out.log(cmds.program_name().basename().raw() + " usage:\n"
00056 "this takes a single parameter, which is the name of a window\n"
00057 "that is expected to be present in the current winstation. if the\n"
00058 "window is found, its window handle is displayed.");
00059 return 1;
00060 }
00061 istring title = cmds.get(0).text();
00062 matching_window = NIL;
00063 window_name_sought = title;
00064
00065 EnumWindows(zingers_enum_proc, 0);
00066 if (!matching_window) {
00067 out.log("no matching window could be found. ignoring request.");
00068 return 1;
00069 }
00070
00071
00072 if (matching_window)
00073 out.log(isprintf("window handle is 0x%lx (or %ld) for ", matching_window,
00074 matching_window) + title + ".");
00075 else
00076 out.log(istring("no window found for ") + title + ".");
00077 return 0;
00078 }
00079
00080 #ifdef __BUILD_STATIC_APPLICATION__
00081
00082 #include <basis/array.cpp>
00083 #include <basis/byte_array.cpp>
00084 #include <basis/callstack_tracker.cpp>
00085 #include <basis/chaos.cpp>
00086 #include <basis/convert_utf.cpp>
00087 #include <basis/definitions.cpp>
00088 #include <basis/earth_time.cpp>
00089 #include <basis/guards.cpp>
00090 #include <basis/istring.cpp>
00091 #include <basis/log_base.cpp>
00092 #include <basis/memory_checker.cpp>
00093 #include <basis/mutex.cpp>
00094 #include <basis/object_base.cpp>
00095 #include <basis/outcome.cpp>
00096 #include <basis/packable.cpp>
00097 #include <basis/portable.cpp>
00098 #include <basis/sequence.cpp>
00099 #include <basis/set.cpp>
00100 #include <basis/trap_new.addin>
00101 #include <basis/untrap_new.addin>
00102 #include <basis/utility.cpp>
00103 #include <basis/version_record.cpp>
00104 #include <data_struct/amorph.cpp>
00105 #include <data_struct/bit_vector.cpp>
00106 #include <data_struct/byte_hasher.cpp>
00107 #include <data_struct/configurator.cpp>
00108 #include <data_struct/hash_table.cpp>
00109 #include <data_struct/pointer_hash.cpp>
00110 #include <data_struct/stack.cpp>
00111 #include <data_struct/static_memory_gremlin.cpp>
00112 #include <data_struct/string_hash.cpp>
00113 #include <data_struct/string_hasher.cpp>
00114 #include <data_struct/string_table.cpp>
00115 #include <data_struct/symbol_table.cpp>
00116 #include <data_struct/table_configurator.cpp>
00117 #include <loggers/console_logger.cpp>
00118 #include <loggers/file_logger.cpp>
00119 #include <loggers/locked_logger.cpp>
00120 #include <loggers/null_logger.cpp>
00121 #include <loggers/program_wide_logger.cpp>
00122 #include <opsystem/byte_filer.cpp>
00123 #include <opsystem/command_line.cpp>
00124 #include <opsystem/critical_events.cpp>
00125 #include <opsystem/directory.cpp>
00126 #include <opsystem/filename.cpp>
00127 #include <opsystem/ini_config.cpp>
00128 #include <opsystem/ini_parser.cpp>
00129 #include <opsystem/path_configuration.cpp>
00130 #include <opsystem/rendezvous.cpp>
00131 #include <textual/byte_format.cpp>
00132 #include <textual/parser_bits.cpp>
00133 #include <textual/string_manipulation.cpp>
00134 #include <textual/tokenizer.cpp>
00135 #endif // __BUILD_STATIC_APPLICATION__
00136