|
Hey, I was sick of ragging on McDonalds, I thought I'd try something new....
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
I'm trying to read from the parallel port in XP. I'm using inpout32.dll.
I need to fetch the 8 data bits at the port by using a loop, and display the result in binary. Can someone [I]please [/I]tell me why this doesn't work?
- The idea is to show the input as soon as it changes. I just keep getting 00FF, and no changes even when I [I]know [/I]bits are being sent "into" the port...
[CODE]
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
/* Definitions in the build of inpout32.dll are: */
/* short _stdcall Inp32(short PortAddress); */
/* void _stdcall Out32(short PortAddress, short data); */
/* prototype (function typedef) for DLL function Inp32: */
typedef short _stdcall (*inpfuncPtr)(short portaddr);
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);
int main() {
HINSTANCE hLib;
inpfuncPtr inp32;
oupfuncPtr oup32;
int j, i;
short x, x2;
printf("hi\n\n");
/* Load the library */
hLib = LoadLibrary("inpout32.dll");
if (hLib == NULL) {
printf("LoadLibrary Failed.");
while(!kbhit()); //wait for user to press a key
return -1;
}
/* get the address of the function */
inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
if (inp32 == NULL) {
printf("GetProcAddress for Inp32 Failed.");
while(!kbhit()); //wait for user to press a key
return -1;
}
oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");
if (oup32 == NULL) {
printf("GetProcAddress for Oup32 Failed.\n");
while(!kbhit()); //wait for user to press a key
return -1;
}
x = inp32(0x378);
x2 = x;
while (x == x2) {
x = inp32(0x378);
}
printf("port read %04X => %d\n", x, (x & 0x01)/0x01);
while(!kbhit()); //wait for user to press a key
FreeLibrary(hLib);
return 0;
}
[/CODE]
|
|
|
|
|
This code is C. this forum is for C++/CLI.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have one MFC application some times it gives me error message "A Required resource was" and I have to close application
from taskbar.
Can ayn one tell me what is that and how to ovecome it.
Thanks,
Rushiraj
|
|
|
|
|
In order to use the proper resource, the first thing you need to do is to post your question in the Visual C++/MFC forum. This is the C++/CLI (Managed C++) forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi everyone,
I would like to know how to concat multiple images into a single one?
I have a form that contains multiple images(in different pictureBoxes), after pressing a button, a new form is displayed containing one image (in one pictureBox)that is the result of concatenating the previous images.
The images are of the same height and width. I need to do that with minimum possible time,
thanks,
|
|
|
|
|
Create a new Bitmap, then use Graphics::FromBitmap ( or is it FromImage ? ). Then you can draw your other Bitmaps on to the new one, in whatever order you like.
If you asked this in the wrong forum, and you're not using .NET, and you're also not using GDI+, then you can do the same with HBITMAPs and a HDC, but the code will be a little more involved.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
//hi the type of threading im using is..
#include <windows.h>
#include <process.h>
using namespace std;
int shutdown=0;
int main(){
unsigned sid;
(HANDLE)_beginthreadex( NULL, 0, sendrecv, NULL, 0, &sid);
while(1){
Sleep(1000);
if(shutdown==1){ break; }
}
}
unsigned __stdcall threadprocess(void *params){
return 0;
}
//What i need to do is pass a string from the main() to the threadprocess.. Please Help.
|
|
|
|
|
|
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Good reply!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I know you meant to post this question here[^]
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
hello,
I created a win32 project(precompiled headers, console application). This was created to create a service( for which i used SERVICE_TABLE_ENTRY, SERVICE_STATUS, SERVICE_STATUS_HANDLE, etc... required structures and methods).
Environment used:
Windows XP, VC++.Net2005.
Should work on:
I want to make this exe to run on windows 95,98, XP, 2000 and Vista.
my stdafx.h file contains:
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
#pragma warning (disable:4430)//... i added this, since i was getting this error. and in msdn this //was given as its solution.
To this project, i have added two more files:
1) USBActivity.h
2) USBActivity.cpp
In USBActivity.cpp the hierarchy of headers included is as follows:
#include "stdafx.h"
#include <initguid.h>
#include "stdio.h"
#include <setupapi.h>
#include <dbt.h>
#include "afxcmn.h"
#include "cfgmgr32.h"
#include "Blowfish_Data_FileEncrpt.h"
#include "USBActivity.h"
The project properties are set as: Use windows Standard libraries, WIN32;_DEBUG;_CONSOLE as preprocessor definitions, Basic Run-TimeChks: Both (/RTC1, equiv. to /RTCsu) , RunTime-Library --> Multi-threaded Debug (/MTd), Use Precompiled Header (/Yu), Linker+AdditionalDependencies-->setupapi.lib.
I am getting following build errors:
Compiling...
stdafx.cpp
Compiling...
Blowfish_Data_FileEncrpt.cpp
DataSentinelService.cpp
d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT'
d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier
d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier
d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : fatal error C1903: unable to recover from previous error(s); stopping compilation
DoubleBuffering.cpp
SHA.cpp
USBActivity.cpp
d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT'
d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier
d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier
d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Generating Code...
DataSentinelService - 8 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I guess the error is because of :
--> calling a function in an SDK header file that is currently not supported in current build environment.
Could anybody help me out... in fixing this problem.
I have also seen the project given at the following link: http://www.codeproject.com/system/RemoveDriveByLetter.asp?df=100&forumid=294340&exp=0&select=1822184&tid=1815457#xx1822184xx
Here, it is given in vc++ 6. and when i compared the build environment everything was same.
In order to enumerate enumerate all the USB devices connected to PC, using a windows service... i have to use setupAPI in order to get setupDiGetDevClass etc methods.
I also tried with including windows.h file in stdafx.h. but it was also not helpful. since was included by-default. And on including it again i am getting the following error:
d:\microsoft visual studio 8\vc\atlmfc\include\afxv_w32.h(16) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Is there any other alternative?
Thanks
Anee
Anee
|
|
|
|
|
This question is no where related to CLI and you have already asked it in VC++[^] forum. So dont cross-post and choose correct forum.
|
|
|
|
|
Hi,
A long long time ago in a compiler far far beyond now, VS2005 without sp1 ... -_-, i've developed a project using native C++ and a lame shell interface, now i thought it could be fun converting the project to a C++/CLI DLL with a managed wrapper class for the main functionality normally controlled by the old shell input and an interface developed in C#, this all works great, however as soon as i switch my executable to dll build, i get a fatal error in the interface telling me he cant load the assembly updater3 wich is my managed dll. I probably thought this would be because the lack of a AssemblyInfo file, however creating a new dll, ripping the assemblyinfo and editing it doesnt help a bit.
Is there someone who can tell me wich rules apply when converting a native application to a managed dll
Thanks already!
|
|
|
|
|
|
Hi.
How could I flush the input buffer in C++/CLI? (in a Console Application of course):->.
Like fflush(stdin) does in C.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Demian Panello wrote: Like fflush(stdin) does in C.
What about using System::IO::FileStream::Flush() ?
|
|
|
|
|
Thank you Prasad.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Hello,
i want to use a Lib in a C# Projekt. Therefore i want to reconfig the Lib-Project (all sources) into a dll Project.
new Settings:
Configuration Typt: Dynamic Library (.dll)
Common Language Runtime support: Common Language Runtime Support (/clr)
For Debug:
Enable C++ Exceptions: No
Runtime Library: Multi-threaded Debug DLL (/MDd)
After this i wand to compile the Project and get a D8045 Error.
-------------------
Only C++ source code files can be passed to a compilation that uses /clr. Use /TP to compile a .c file as a .cpp file; see /Tc, /Tp, /TC, /TP (Specify Source File Type) for more information.
-------------------
one source-File is a c-File.
does that run at all ore have i find another solution?
|
|
|
|
|
Did you follow the instructions in the error message?
Use /TP to compile a .c file as a .cpp file; see /Tc, /Tp, /TC, /TP (Specify Source File Type) for more information.
led mike
|
|
|
|
|
Hi all,
Iam working on Pointers. How would I pass this memory location as an argument to a function?
ie.,
#define REG (*((volatile unsigned long *) 0x3FFFC00E))
this is my function
void funcTest( unsigned long reg, char value)<br />
{<br />
reg= value;<br />
}<br />
I need to pass the "REG" as an argument so that I write the "value" to that particular memory location or the register.
|
|
|
|
|
I'm not sure what you are trying to do...
REG dereferences the pointer so it becomes the unsigned long stored at address 0x3FFFC00E.
You need a reference or pointer to an object passed to a funtion if you want to modify the object
in the function:
Then in your func you assign a char to an unsigned long??
Whatcha tryin to do?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Looks to me like you're in the wrong forum, this doesn't look like a .NET C++ question. Try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|