windows

how to do event based serial port reading in c?

i want to read serial port when there is some data present i mean on the event when data arrives only then i will read serial port instead of continuously reading the port i have this code for continuous reading the port how can i make it event based. thanx in advance. while(1) { bReadRC = ReadFile(m_hCom, &byte, 6, &iBytesRead, NUL...

Differentiate between TCHAR and _TCHAR

What are the various differences between the two symbols TCHAR and _TCHAR type defined in the Windows header tchar.h? Explain with examples. Briefly describe scenarios where you would use TCHAR as opposed to _TCHAR in your code. (10 marks) ...

What happens at OS level when a .net program exits due to an uncaught exception?

Actual question(s): What happens "in Windows" when a program crashes from an uncaught exception? Is there a dll function, which I can hook, to log some basic information about a crash? Context: I am planning to write a program which will collect some very basic information about any applications which crash on my local pc. I was hopi...

I would like to run my Java program on System Startup on Mac OS/Windows. How can I do this?

Here is what I came up with. It works but I was wondering if there is something more elegant. Thank you! Misha /* Copyright (c) 2010 Misha Koshelev. All Rights Reserved. * * TODO: * - Add Linux support */ package com.mksoft.common; import java.io.BufferedReader; import java.io.File; import java.io.FileWriter; import java.io.InputS...

How to preview any files inside a Java application ?

I'm using a JTree to browse the content of a folder and I want that when a user click on a file, the software shows a preview of it (a screenshot of its first page). The files are mostly Office documents and PDF. I manage to do it for PDF file using a module downloaded from Sun, but I'd like to know if there is a way to do it using any...

Cross-compiling a Python script on Linux into a Windows executable

I have a Python script that I'd like to compile into a Windows executable. Now, py2exe works fine from Windows, but I'd like to be able to run this from Linux. I do have Windows on my development machine, but Linux is my primary dev platform and I'm getting kind of sick of rebooting into Windows just to create the .exe. Any ideas? PS: I...

Globbing with MinGW on Windows

I have an application built with the MinGW C++ compiler that works something like grep - acommand looks something like this: myapp -e '.*' *.txt where the thing that comes after the -e switch is a regex, and the thing after that is file name pattern. It seems that MinGW automatically expands (globs in UNIX terms) the command line so ...

windows .bat file how to recursively list all files of type *.mp3

hello i want to recursively list the absolute path to all files that end with mp3 from a given directory which should be given as relative directory. i would then like to strip also the directory from the file and i have read that variables which are in a for-scope must be enclosed in !s. is that right? my current code looks like this:...

ASP.NET 4 - IIS 7 - Request timed out - Request timed out

My website is running on Asp.net v4 , IIS 7 , Windows server 2008. My cpu is running on 20-30% and the site is responding quickly. Every 2-5 mins i'm receiving the following error: Event code: 3001 Event message: The request has been aborted. Exception type: HttpException Exception message: Request timed out. , Request informatio...

ASP.NET MVC2, getJSON, Jquery Windows 7 64bit IIS

I have started learning MVC2. I developed a simple customer search screen with Jquery and Json calls. In debug mode everything works. When i deployed to my local iis server and after configuring the app pools i got the app to run. When i do the search nothing happens, it like the json call is not working and i dont get any errors eith...

Working with sockets in MFC

I'm trying to make a MFC application(client) that connects to a server on ("localhost",port 1234), the server replies to the client and the client reads from the server's response. The server is able to receive the data from the client and it sends the reply back to the socket from where it received it, but I am unable to read the reply...

Regex to add CDATA for mal formed XML

Hey guys! I have this huge xml file (13 mb) and it has some malformed values. Here is a sample of the xml: <propertylist> <adprop index="0" proptype="type" value="Ft"/> <adprop index="0" proptype="category" value="Bs"/> <adprop index="0" proptype="subcategory" value="Bsm"/> <adprop index="0" proptype="de...

Can Folder Shortcuts be explored from within SHBrowseForFolder?

I'm trying to resolve an issue that I brought up at the end of the investigation into SHBrowseForFolder and folder shortcut browsing: I cannot figure out how IFolderFilter's member function ShouldShow should work to filter out everything but folders and folder shortcuts. I haven't found much documentation on this and my current solution...

Robustly killing Windows programs stuck reporting 'problems'

I am looking for a means to kill a Windows exe program that, when being tested from a python script, crashes and presents a dialog to the user; as this program is invoked many times, and may crash repeatedly, this is not suitable. The problem dialog is the standard reporting of a Windows error: "Foo.exe has encountered a problem and ne...

Looking for merge tool with very good in-line-comparison support

I have seen this topic discussed several times, but emphasis is on "very good in-line-comparison" here, which was not really covered by those threads. E.g. I would like the tool to recognize and highlight that the resource "colorpicker_newstring" has been added when comparing the following two blocks. WinMerge and Kdiff both fail... Doe...

Windows GUI Automation

Hello, I am planning to automate some of the functionality of the GUI developed in Microsoft Visual C#. I am new to Automation with GUI. Would be glad if you share your experience regarding GUI Automation and some of the tools available for the automation. I plan to develop some programms / scripts in order to realise some of the fun...

Using sys/socket.h functions on windows

Hello, I'm attempting to utilize the socket.h functions within Windows. Essentially, I'm currently looking at the sample code at http://beej.us/guide/bgnet/output/html/multipage/clientserver.html#datagram. I understand that socket.h is a Unix function -- is there anyway I can easily emulate that environment while compiling this sample c...

Short file names versus long file names in Windows

I have some code which gets the short name from a file path, using GetShortNameW(), and then later retrieves the long name view GetLongNameA(). The original file is of the form "C:/ProgramData/My Folder/File.ext" However, following conversion to short, then back to long, the filename becomes "C:/Program Files/My Folder/Filename.ext"....

Create a CSR in C# using an explicit RSA key-pair

Using the OpenSSL libraries one can create a CSR (certificate signing request) by doing this: openssl genrsa -out rsa.key 1024 openssl req -new -key rsa.key -out output.csr -config config.txt where config.txt contains the distinguished name to use in the certificate. I would like to do something similar under Windows using C#. Howe...

I get an Access Denied error when calling LsaQueryInformationPolicy(), and I'm an admin

I get this error return whether I try LsaQueryInformationPolicy() on the local host or on some other machine in the domain. The flags I use for LsaOpenPolicy() are POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION but I also tried POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION | READ_CONTROL without success. The user I'm logged i...