|
I want List of Ports associated with a Process using Window Management Instrumentation ? can it be done using WMI? if yes how ?
Thanks
|
|
|
|
|
Hi All,
i am posting one url through http request with setting this
"x-microsoftajax;Delta=true" header but i am getting "400" http error code, can someone please give me suggestions on it.....
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
how can i change the colour of ny dialog box and the looks of dialog box in MFC like what we can do with forms in C#
thanks.
|
|
|
|
|
You need to fill certain areas using CPen object.
|
|
|
|
|
|
Hello Friends
I created one .exe that is deleting some files from one folder.
If I do Start Debugging then It is deleting all the files But If i run that exe then it is giving Window error.
What could b the reason?
And I m using remove to delete files.
|
|
|
|
|
|
yogeshs wrote: But If i run that exe then it is giving Window error.
What could b the reason?
With that level of detail, it's anybody's guess.
yogeshs wrote: And I m using remove to delete files.
If remove() fails, check errno .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Could you show your code?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
As per Add Windows XP Theme Style to your current projects[^] I created a manifest file for my MFC 6 app to make it look a bit nicer on XP et al. But the theming causes one of our 3rd party controls to barf all over the place and crash the app.
Can you use a manifest file to tell Windows NOT to theme a particular control? And if so, how?
Or do I actually have to figure out what a manifest file actually does?
Thanks all
|
|
|
|
|
The manifest file instructs the operating system which run times, or side-by-side (SxS) assemblies (DLLs) the program is to link to. To my knowledge, this is an all or nothing proposition for an executable.
|
|
|
|
|
Hi Kyudos,
You can use the SetWindowTheme Function[^] to exclude a window from theming. Simply set the parameters to empty strings.
SetWindowTheme(hWnd,L"",L"");
I do not know how this will effect controls inside controls. You may need to recursively call the function for all child windows.
Best Wishes,
-David Delaune
|
|
|
|
|
The project involves the game scramble, where we have a 4x4 matrix of characters. The purpose of the program is to search through the matrix and find words in the matrix. I have a dictionary .txt file and can search that for a word correctly and can also print the 4x4 matrix. The problem lies on how to actually search the matrix for a word. The letters can be combined to form a word by any "touching" letters.
For example:
D O P C
H L A R
E S M T
B D E I
One of the words would be car.
So, basically, I need help with how you would go through the matrix and how you would be able to move to any letter touching.
int main(){
FILE* Lex = fopen("lex.txt", "r");
int i = 0;
int j = 0;
char *word = "attack";
char game[4][4] = {{'a', 'b', 'c', 'd'},{'e', 'f', 'g', 'h'},{'i', 'j', 'k', 'l'},{'m', 'n', 'o', 'p'}};
for ( i = 0; i <= 3; i++){
for( j = 0; j <= 3; j++){
game[i][j];
printf("%c", game[i][j]);
if(j == 3){
printf("\n");
}
}
}
char tmp[256]={0x0};
while(Lex!=NULL && fgets(tmp, sizeof(tmp),Lex)!=NULL){
if (strstr(tmp, word)){
size_t lengthTmp = strlen(tmp);
size_t lengthWord = strlen(word);
if(lengthTmp - 1==lengthWord)
printf("%s", tmp);
}
}
if(Lex!=NULL)
fclose(Lex);
system("PAUSE");
return 0;
}
I know I'm missing some things but I need some ideas on how to do a search method before I can fine tune the code. Any help is appreciated...Thanks in advance. Will be glad to clarify if anything is confusing.
|
|
|
|
|
Use the "trackback" algorithm. Start from the first letter, let's say, top-left, step to the first neighbouring letter, check your 2 letters in the dictionary, if it is there, store it, then from your second letter move to its first neighbour, now you have a 3 letter word, check it against the dictionary, now step to the first neighbour of the third letter, you have a 4 letter word, check it, and so on, you do this until you cannot step any further ahead, then comes the trackback part, you step back from the last letter to the "bafore the last" one, and take this letter's second neighbour and try to move forward until you get stuck again, then you step back again and take the next neighbour and so on...so you have to record your path as you move along and when you step back from a letter because you had no more neighbours to visit, you have to know which neighbour the letter was you stepping back from and you have to try to step onto the next neighbour. Once you walked all the possibilities and you get back to the very first letter of the track and cannot move to any neighbours anymore (since you tryed the all), you move to the next letter in the grid (so if your top-left letter was the root of your first track, tnen for example you move to the top-center letter and start the whole trackbacking again). When you run out of all the letters, you are done. I supose you are not allowed to use the same letters multiple time in a word, so every time you step ahead from a letter, you must ensure that you do not take a letter that is already in your current path.
So if i were you i would store more than just a letter in the grid, i would store a flag i would set to -let's say- 1 if the letter is already in the current path and back to 0 if it is not anymore, then when i am steping forward i could easily check what letters not to take. I would probably, to speed up things, also store for every cell a list of its neighbours as coordinates so when i take a letter i would know its neighbours.
In my path i would store the coordinates of the letters and the index of the next or current neighbour so when the step-back occurs i know where to continue.
I hope this is enough to do your homework.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
thanks that helped a bunch
|
|
|
|
|
Hi there,
I am in the progress of building a program that uses the LPT port to program a cpu through a circuit. I have the source files from an older program that does exactly what i want but it is in DOS. I need to do the same in winxp. In order to gain access to the LPT i need inpout32.dll or something similar. I am not an experienced c/c++ programmer so i need a little help. The program has to send some data to reset the cpu in order to be able to enter in debug mode. Then it reads it and writes the data to a file. After that it open a file and programs the cpu. I am reading all the datasheets about the cpu and the protocoll and i have the source files from an older program in DOS. I am a bit confused. Do i need to write a driver to achieve this??? Or do i need to just program a software? The source files i've got are of any use in my project? In linux they program a driver and they use a debugger to achieve this. There is also a Win NT driver for this. But in win95 there are some programs that don't have a driver for this purpose. Thay all work with the same circuit.
So what is your opinion in this?
Thank you in advance
Padelis
P.S.: The cpu is a motorola/freescale MC68HC16 series and the protocol is BDM through LPT.
|
|
|
|
|
|
OOPS!!! Sorry, i forgot to mention that. Yes, i need individual data pin control, that's why i downloaded inpout32!! Do you think that PortTalk is better?? And what is the second step?? Do i need to create a driver???? All the implementations that i have seen using linux and one for WinNT create a driver and then use a general degugger program to read or write like gdb!!! But there are two programs that don't use such a driver. One is Tranxbdm 1.6 which is for win95 but it programs certain cpu registers. I want to program all the cpu registers.
|
|
|
|
|
psychegr wrote: Do you think that PortTalk is better??
It doesnt really matter as they both function in the same way. The inpout32.dll has a device driver embedded in its resource section and drops/creates a .SYS file when you load the DLL.
psychegr wrote: And what is the second step?? Do i need to create a driver????
No, you simply start communicating with your MC68HC16 controller board using the _outp, _outpw, _outpd[^] functions.
psychegr wrote: But there are two programs that don't use such a driver. One is Tranxbdm 1.6 which is for win95 but it programs certain cpu registers.
Yes, Linux, Win95, Win98, and WinME allow applications to perform I/O directly to the ports. Operating systems based on the NT kernel are running in protected mode[^] and isolate usermode programs from the hardware.
psychegr wrote: I want to program all the cpu registers.
You can start right now. Just call the _outp function with the hardware address of your LPT1 port which is most often at 0x378 but you need to open the device manager to make sure. After you open the device manager you need to right click on your LPT1 printer port and choose the 'Resource' tab which will show you the I/O range.
Good Luck,
-David Delaune
|
|
|
|
|
Ok thank you David!!
One more question for now. I am using the original c source files from 1992 to write my code. Just a few corrections and it shall work! But i found a driver for winnt that it should help me a lot! What i want to ask is that back in 1992 in the original code there were some timing for the program to work. The author back then used assembly language to implement this. In the winnt version sources that i have the author uses KeStallExecutionProcessor which is from the Windows DDK! I need this in order for my program to work. Should I compile it using the vc++ compiler or the WDK compiler??? With the vc++ compiler i get a lot of errors! I am using vc++ 2008 express!!
Thank you and sorry for asking so many!!! I just don't have someone to guide through this!!
|
|
|
|
|
KeStallExecutionProcessor is a kernelmode function that cannot be accessed from usermode on a NT based operating system. A quick question:
What is the purpose of the KeStallExecutionProcessor calls?
If the purpose is to generate a pulsed signal... you may have problems with timing. Microsoft operating systems based on the NT kernel utilize preemptive multitasking[^] which essentially means that if something more important comes up... such as Sound/Audio or a vast list of other things the OS considers important... your usermode application will be stalled. Executing your application in HIGH_PRIORITY_CLASS[^] might help this situation a little... but not much. Windows is simply not a real-time operating system, your application can still be preempted.
If the purpose of the KeStallExecutionProcessor calls are to simply give time for the MC68HC16 to complete the instructions provided then you can just use the Sleep Function[^].
psychegr wrote: Thank you and sorry for asking so many!!! I just don't have someone to guide through this!!
Not a problem, I enjoy helping.
Best Wishes,
-David Delaune
|
|
|
|
|
Dear David,
I am using inpout32.dll but i always get "error LNK2019: unresolved external symbol _Out32@8 referenced in function....."!!
Same for the "Inp32"!!! I have added he library directory to the project properties and the dll to all possible directories and I have this error. What am I doing wrong??? Can you suggest other driver which will work with my project? I am using VC++ 2008 Express!!
Thank you in advance!
|
|
|
|
|
Hi Padelis,
psychegr wrote: but i always get "error LNK2019: unresolved external symbol _Out32@8 referenced in function....."!! Same for the "Inp32"!!!
Question: Was the old code written for the Borland C/C++ compiler? I believe Out32 is the Borland version of Microsofts modern _outpw[^].
psychegr wrote: Can you suggest other driver which will work with my project?
I always recommend using PortTalk - A Windows NT I/O Port Device Driver.[^]
If you look at our previous chat you will see where I have already recommended using this. The post also contained instructions for using it. Anyway... the problem is probably not inpout32.dll. I believe your problem is calling Borland I/O functions from VC++ 2008 Express. Try changing those Out32 function calls to _outpw and replace Inp32 with inpw.
Make sure you use the correct function for the IN/OUT data size (BYTE,WORD,DWORD). Here is the MSDN reference docs:
_inp, _inpw, _inpd[^]
_outp, _outpw, _outpd[^]
Come back and ask if you have more problems.
Best Wishes,
-David Delaune
|
|
|
|
|
I was thinking to implement a PortTalk like code in my program but i will give it a try like you are suggesting!
Out32 and Inp32 are the functions from the inpout32.dll!!
The original source code was written for Turbo C!!! Is there a site or reference manual to do the convertion from Borland Turbo C to Microsoft Visual C++ 2008 Express???? I think that I will make a huge step with this! I thought that both compilers were the same !!! My fault!!!
I will change all the functions as you are suggesting and I will try to understand what the original author tried to do in Turbo C, so that i can transfer the code to VC++!!!
David you are really helpfull!!! Thank you very much, you are my teacher !!!!
|
|
|
|
|
David,
Do you see any wrong in this code?
I get always the error C2440 "=" cannot convert from "char [64]" to "unsigned char *"!
int do_srec (srecord *where, FILE *infile)
{
int ctr,asize,c;
BYTE *put, s9flag = 0;
do c = fgetc (infile);
while (c != 'S' && c != EOF);
if (c == EOF) return SREC_EOF;
FREAD (infile,where->rectype);
switch (where->rectype)
{
case '0':
asize = 2;
break;
case '1':
case '2':
case '3':
asize = 1 + where->rectype - '0';
break;
case '7':
case '8':
case '9':
asize = 11 - (where->rectype - '0');
s9flag = 1;
break;
default:
return SREC_FORMAT;
}
checksum = 0;
where->reclen = collect (1,&c, infile);
where->address = 0;
for (ctr = asize; ctr; ctr--)
{
where->address <<= 8;
where->address |= collect (1,&where->reclen, infile);
}
put = where->bytes;
for (ctr = where->reclen-1; ctr; )
*put++ = collect (1, &ctr, infile);
collect (1, &where->reclen, infile);
if (checksum != 0xff) return SREC_CHECKSUM;
where->reclen += 4;
return s9flag ? SREC_S9 : 0;
}
The error occurs in the 8th line from the end!
|
|
|
|
|