<rss version="2.0">
<channel>
<title>comp.os.mswindows.programmer.win32</title>
<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/</link>
<description>Posts for comp.os.mswindows.programmer.win32</description>
<lastBuildDate>Fri, 16 May 2008 07:44:49 PDT</lastBuildDate>
  <image>
    <title>http://www.nnseek.com/</title>
    <link>http://www.nnseek.com/</link>
    <url>http://www.nnseek.com/img/64.png</url>
    <width>64</width>
    <height>64</height>
    <description>NNSeek</description>
  </image>
<item>
	<title><![CDATA[Re: Getting key input to edit/combo controls on custom dialog.]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103989648t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103989648t.html</link>
	<description><![CDATA[On 16 mai, 14:02, k.bramh...@<a href="http://googlemail.com" rel="nofollow" class="url" target="_blank">googlemail.com</a> wrote:

> I have tried picking up the WM_GETDLGCODE message. This is being send
> to my dialog procedure. The return value of a dialog procedure is a
> BOOL so how can I return the values that are indicated in the MS
> documentation like DLGC_WANTALLKEYS (which has a value of 4)?
>

WM_GETDLGCODE is handled by subclassing controls.
But I don't understand when you say "What does not work is text
entry..."
Nothing is needed to enter text into Edit controls (fortunately..)<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103989648t.html">no comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103989648m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 07:44:49 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Re: Getting key input to edit/combo controls on custom dialog.]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103983760t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103983760t.html</link>
	<description><![CDATA[Partly solved, the following bit works for an editable combo control
so I can now enter text to it:-
I found that by trapping the WM_LBUTTONDOWN to set the focus I could
then test not only the msg.hwnd to see if it was one of my controls
but, if that failed, test the result of ::GetParent(msg.hwnd) and if
that fails ::GetParent(::GetParent(msg.hwnd)) to look for a recognised
hwnd and then pass the recognised hwnd to IsDialogMessage() as normal.

The above solution does not work for the standard "edit" class of
control that I create with something like this:

	m_hWnd = CreateWindow(
		TEXT("edit"),
		NULL,
                                WS_CHILD | WS_VISIBLE | WS_BORDER |
ES_AUTOHSCROLL | ES_LEFT | WS_TABSTOP,
		m_sRect.left, m_sRect.top, m_sRect.right - m_sRect.left,
m_sRect.bottom - m_sRect.top,
		hwnd,		// Parent window - my custom dialog HWND
		(HMENU)id,	// Windows "ID" for this control
		CGuiApplication::hInst,
		NULL);

I could convert a combo control into an edit look-a-like by removing
CBS_DROPDOWN from the syle bits before I create it and then I have
something that works. But what if I have to use an ordinary edit
control, what should I do to make it work when added to my custom
dialog that is different to what you need for a combo edit control?

Thanks.<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103983760t.html">no comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/getting_key_input_to_edit_combo_controls_on_custom_103983760m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 07:13:44 PDT</pubDate>
</item>
<item>
	<title><![CDATA[UI hangs as Countinously going into WM_PAINT]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/ui_hangs_as_countinously_going_into_wm_paint_103977872t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/ui_hangs_as_countinously_going_into_wm_paint_103977872t.html</link>
	<description><![CDATA[Hi

I have a winproc defined as follows:

private IntPtr ReadingPaneProc(IntPtr hWnd, int msg, IntPtr wParam,
IntPtr lParam)
        {
            System.Windows.Forms.Message m =
System.Windows.Forms.Message.Create(hWnd, msg, wParam,
lParam);
            switch (m.Msg)
            {
                case WM_SETCURSOR:
                    MessageBox.Show("Cursor changed");
                    break;

                case WM_PAINT:
                    //InvalidateRect(hWnd,IntPtr.Zero,true );
                    ////BeginPaint(hWnd, out pstruct);
                    ////EndPaint(hWnd, out pstruct);
                    //ValidateRect(hWnd,ref r);
                    DefReadingPaneProc(ref m);
                    break;

                default:
                    DefReadingPaneProc(ref m);
                    break;
            }
            return m.Result;
        }


however my UI completely hangs for infinity as It is coumtinoulsy
going in WM_PAINT
I tried all cominations  of InvalidateRect(), ValidateRect(),
BeginPaint(), EndPaint(), DefReadingPaneProc() together and singly.
Howver no luck

can somebody point what wrong I am doing<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/ui_hangs_as_countinously_going_into_wm_paint_103977872t.html">no comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/ui_hangs_as_countinously_going_into_wm_paint_103977872m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 06:36:48 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Accessing &quot;in Use&quot; Files == ?]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/accessing_in_use_files_103935120t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/accessing_in_use_files_103935120t.html</link>
	<description><![CDATA[How can I access the files that are in-use by other processes. Say
there is this file called "locked.txt", which is in use by process A.
Now how can I copy this file to another location programmatically.
Normal methods will fail with the error "The process cannot access the
file because it is being used by another
process.".

Any ideas ?<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/accessing_in_use_files_103935120t.html">no comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/accessing_in_use_files_103935120m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 00:25:23 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Problem In Programming Registry]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/problem_in_programming_registry_103934864t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/problem_in_programming_registry_103934864t.html</link>
	<description><![CDATA[I have a tool that scans(parses) the registry for invalid entries and
deletes them.
I looked for things that are considered as "invalid registry entries"
and found many things that comes in the criteria, like following-

Missing shared dlls
Unused file extensions
activex issues
COM issues
class (Invalid or empty class) issues
MUI cache
etc.

My question is that how can I determine wheather an entry in a
registry is invalid or not according to above criteria.<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/problem_in_programming_registry_103934864t.html"><b>1</b> Comment</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/problem_in_programming_registry_103934864m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 00:25:02 PDT</pubDate>
</item>
<item>
	<title><![CDATA[More Info Needed In Process Enumeration]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/more_info_needed_in_process_enumeration_103934608t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/more_info_needed_in_process_enumeration_103934608t.html</link>
	<description><![CDATA[There is this tool that fetches the list of all the running processes
and then flags all those processes that are dangerous. Now getting the
list of all the running processes is trivial and has been discussed on
the forums infinite times. What I ask is how does the tool decides
wheather a process is dangerous or not. My first thought was that this
tool monitors all the api calls of all the processes and then based on
that info it determines the dangerous processes but this can't be true
since system processes uses almost same apis that are used by
dangerous processes (like accessing registries and files on disk
etc.). Any ideas? (otherwise I would have to reverse the program
myself to find out how it does that)<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/more_info_needed_in_process_enumeration_103934608t.html"><b>1</b> Comment</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/more_info_needed_in_process_enumeration_103934608m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 00:24:37 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Implementing Custom Subsystem == ?]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/implementing_custom_subsystem_103934352t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/implementing_custom_subsystem_103934352t.html</link>
	<description><![CDATA[How can I implement my own custom subsystem in windows ?<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/implementing_custom_subsystem_103934352t.html">no comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/implementing_custom_subsystem_103934352m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 00:24:19 PDT</pubDate>
</item>
<item>
	<title><![CDATA[custom message on deletion of file...]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/custom_message_on_deletion_of_file_103933584t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/custom_message_on_deletion_of_file_103933584t.html</link>
	<description><![CDATA[While deleting some files on windows XP, I get this message
"Deleting this File Will Make some Programs not Work"
I want to know weather I can produce a particular message, like above,
when a file gets deleted.

(May be I need to monitor certain files using hook, and when the hook
notifies me of their deletion, I show a messagebox like above. But I
want to know how "windows" do it).<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/custom_message_on_deletion_of_file_103933584t.html"><b>2</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/custom_message_on_deletion_of_file_103933584m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Fri, 16 May 2008 00:23:46 PDT</pubDate>
</item>
<item>
	<title><![CDATA[finding out application dependencies;]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/finding_out_application_dependencies_103910544t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/finding_out_application_dependencies_103910544t.html</link>
	<description><![CDATA[How can I find out the dependencies of an application inside my
program/driver? Say e.g If I want to find out the dependencies of
iexplorer.exe inside my program? What are the APIs? I knwo there is a
program something called dependency walker so I assume there must be
some way of doing this.

I want to provide a GUI which lists all the programs installed on the
computer and when user cselects one of them I lists all the files
(.dlls etc) on which it is dependent.<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/finding_out_application_dependencies_103910544t.html"><b>1</b> Comment</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/finding_out_application_dependencies_103910544m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Thu, 15 May 2008 19:47:29 PDT</pubDate>
</item>
<item>
	<title><![CDATA[C crash on free/malloc and sometimes printf]]></title>
	<guid>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/c_crash_on_free_malloc_and_sometimes_printf_103834256t.html</guid>
	<link>http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/c_crash_on_free_malloc_and_sometimes_printf_103834256t.html</link>
	<description><![CDATA[Hello,

I've done a small application that sometimes crashes on the free,
sometimes doesn't allocate memory correctly (malloc) and sometimes
crashes on printf flush procedure. What can I do to correct this
library?

The code follows below.

Thanks in advance.


/*! \file timerthread_win32.c
 */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "timerthread.h"

/* Debug related definitions. */
#ifdef DEBUG_TIMERTHREAD
 #define dprintf printf
#else
 #define dprintf
#endif

//
-----------------------------------------------------------------------------
// -- Local types --
//
-----------------------------------------------------------------------------

typedef struct timer_thread_params_s {
	p_timer_func_t p_func;
	void *p_func_params;
	struct timespec *p_time;
} timer_thread_params_t;

//
-----------------------------------------------------------------------------
// -- Function bodies --
//
-----------------------------------------------------------------------------

void timer_thread_start(void *params) {
	timer_thread_params_t *p = (timer_thread_params_t*)params;
    //Sleep for the specified amount of time
	Sleep(((DWORD)p->p_time->tv_sec * 1000) + (p->p_time->tv_nsec /
1000000L));
	//Execute p_func
	p->p_func(p->p_func_params);
	//Free p
	free(p);
}

//
-----------------------------------------------------------------------------

int start_timer_thread(struct timespec *p_time, p_timer_func_t
p_timer_func, void *p_timer_func_params) {
	HANDLE thread;
	timer_thread_params_t *p;

	//Check params
	if (p_time == NULL || p_timer_func == NULL || p_timer_func_params ==
NULL) {
		return OTHER_ERROR;
	}
	if ((p_time->tv_sec < 0) || (p_time->tv_nsec < 0) || (p_time->tv_nsec
> 999999999L)) {
		dprintf("Bad params\n");
		return LIBTIMERTHREAD_ERROR;
	}

	p = (timer_thread_params_t*)malloc(sizeof(timer_thread_params_t));
	if (p == NULL) {
		dprintf("Not enough memory\n");
		return LIBTIMERTHREAD_ERROR;
	}
	p->p_time = p_time;
	p->p_func = p_timer_func;
	p->p_func_params = p_timer_func_params;

	dprintf("Going to call timerthread with %%is,%%ims\n", p->p_time-
>tv_sec, p->p_time->tv_nsec);

	//Call CreateThread
	thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)timer_thread_start, (LPVOID)p, 0, NULL);
	if (thread != NULL) {
		dprintf("Timer thread OK\n");
		return SUCCESS;
	}
	else {
		dprintf("Timer thread KO\n");
		return IO_ERROR;
	}
}




/*! \file timerthread.h
 */

#ifndef _LIB_TIMER_THREAD_H_
  #define _LIB_TIMER_THREAD_H_

#include <time.h>

#ifdef WIN32
 #ifdef _WINDLL     // building a DLL
  #define DLL __declspec(dllexport)
 #elif defined _LIB // building a static lib
  #define DLL
 #elif defined LINK_DLL // build app linked to DLL
  #define DLL __declspec(dllimport)
 #else                  // build app linked to static lib
  #define DLL
 #endif
 #include <windows.h>
 struct timespec {
	 time_t tv_sec; /* Seconds since 00:00:00 GMT, 1 January 1970 */
	 long tv_nsec; /* Additional nanoseconds since tv_sec */
 } timespec_t;
#else // linux
 #define DLL
 #define FALSE 0
 #define TRUE  ~FALSE
#endif

#define SUCCESS              0
#define IO_ERROR             (-1) // when a system IO call returns
with error.
#define LIBTIMERTHREAD_ERROR (-2) // internal LIBTIMERTHREAD error,
timer_thread_error_ is set with the error code
#define OTHER_ERROR          (-3) // other error, more info is only
available through the log

#define _LIBTIMERTHREAD_VERSION_ 0.2

/*
--------------------------------------------------------------------------
*/
/* -- API types
--                                                            */
/*
--------------------------------------------------------------------------
*/

typedef void(*p_timer_func_t)(void*);

/*
--------------------------------------------------------------------------
*/
/* -- prototypes
--                                                           */
/*
--------------------------------------------------------------------------
*/

/*! \fn int start_timer_thread(struct timespec *p_time, p_timer_func_t
timer_func, void *p_timer_func_params)
 *  \brief Creates a schedule to launch a specified function with the
specified arguments.
 *  \param p_time Delta time to launch the function.
 *  \param timer_func Pointer to the function.
 *  \param p_timer_func_params Arguments to the function.
 *  \returns Returns SUCCESS if successfully scheduled or error type
code if failed.
 */
DLL int start_timer_thread(struct timespec *p_time, p_timer_func_t
timer_func, void *p_timer_func_params);

#endif




#include <stdio.h>
#include <conio.h>
#include "timerthread.h"

#define SECS 0
#define NSECS 999999999L
#define SIZE 5

void timer_f(int *v) {
	printf("Timer %%d expired\n", *v);
}

int main() {
	struct timespec time;
	int i, iarray[SIZE];
	<a href="http://time.tv_sec" rel="nofollow" class="url" target="_blank">time.tv_sec</a> = SECS;
	<a href="http://time.tv_nsec" rel="nofollow" class="url" target="_blank">time.tv_nsec</a> = NSECS;
	for (iarray[i = 0] = i; i < SIZE; iarray[i++] = i) {
		start_timer_thread(&time, timer_f, &iarray[i]);
	}
	getch();
}<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/">comp.os.mswindows.programmer.win32</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/c_crash_on_free_malloc_and_sometimes_printf_103834256t.html"><b>7</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/comp.os.mswindows.programmer.win32/c_crash_on_free_malloc_and_sometimes_printf_103834256m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Thu, 15 May 2008 10:47:27 PDT</pubDate>
</item>
</channel>
</rss>