|
I'm not sure whether to laugh or cry.
Can you do this on paper? If not, then don't bother with trying to code it.
"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
|
|
|
|
|
42. Always. Don't bother calculating, the answer is always 42
|
|
|
|
|
You are smoking the wrong stuff. Try herbal tea.
|
|
|
|
|
Hello Forum,
I have an C++ Control (RichClient) which contains a .NET Infragistics UltraWinGrid Control. The UltraWinGrid Control isn't repainted correctly, if other controls like Topmenu / or other C++ Windows are displayed and closed on top of the UltraWinGrid Control.
Even for example embedded DateTime Controls in the UltraWinGrid Cells only repaint the parts they cover, if in the method AfterCloseUp parent.Invalidate(true) is called.
Which Strategy could help me out to ensure the repainting of the UltraWinGrid-Parts (in .NET) out of C++, which has been coverd by other C++ controls?
thanks a lot
Sebastian
|
|
|
|
|
Try responding to the underlying window's WM_ERASEBKGND message. That is, if the grid is in a dialog, respond to the dialog's WM_ERASEBKGND message, invalidating the grid there.
|
|
|
|
|
Background: I am an embedded 'C' programmer, with no windows development experience other than simple console applications using Win32. I have developed using classes but mostly in Java. Other than the ubiquitous "Hello World" using Windows Forms and C++, I have limited to no windows programming experience.
Problem:I have a project where I need to interface an embedded controller to a windows application. Ultimately I need to translate input from windows controls into a stream of serial characters. This stream is interpreted by the embedded controller to do "stuff". The serial interface here may be a "real" serial port, or through a USB-Serial converter cable.
I don't have the money to buy comm libraries, I am using the Visual Studio 2008 Express because it is free, and unless it is absolutely necessary, I am not interested in learning another language like C# or Visual Basic. It is difficult enough for a 'C' coder in the embedded world to transition into the windows world of C++. I don't understand the implications of using ATL vs. MFC vs CLR vs Win32, so please be gentle.
I have posed this question now a half a dozen other forums and keep getting references to Visual C++ 2005 or 2006 code that will not compile in the .NET vernacular (did I get the nuance correct?) Or admonishments to "Just use ___" (insert any of J#, C#, VB or PHP). What used to be a simple:"fputc(com1, "My String");" is now a multilayered, insulated, managed into obscurity onion of code.
If I understand it correctly, in the Win32 vernacular, there is a serial port class, that can be used to instantiate an object that has methods for determining if a port exists, setting port parameters (like BRPY- Baud rate and parity, and flow control) as well as mapping the "<<" and ">>" operators to accommodate inserting/retrieving objects (like a string) into the stream.
I have yet to see an example of code, written using Win32, that will demonstrate moving a single character to a serial port, using the Visual Studio 2008 toolbox.
I need to lean on the experience of more informed programmers for guidance and direction to help me to the next step. Any help or direction (even if it is an admonishment to "RTFM" as long as the requisite "FM" is given) would be greatly appreciated.
David
Melbourne, Florida
|
|
|
|
|
dk-info wrote: Problem:I have a project where I need to interface an embedded controller to a windows application. Ultimately I need to translate input from windows controls into a stream of serial characters. This stream is interpreted by the embedded controller to do "stuff". The serial interface here may be a "real" serial port, or through a USB-Serial converter cable.
See here.
"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
|
|
|
|
|
Thank you for the rapid response.
I used a portion of the code you presented to illustrate how to so simple serial output from a Win32 console application. I was able to create a Handle using this code:
#include <iostream>
#include <windows.h>
#include "serialPlay.h"
using namespace std;
int main(void)
{
HANDLE hCom;
DWORD dwRet;
hCom = ::CreateFile(
TEXT("\\\\.\\COM1"),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
if(hCom == INVALID_HANDLE_VALUE) {
cout << "Cannot open serial port COM1\n";
return PROGRAM_FAILURE;
} else {
WriteFile( hCom, "This is testfile", 16, &dwRet, NULL );
}
return PROGRAM_SUCCESS;
}
It compiles and runs using Visual C++ in Visual Studio 2008 Express, in a Win32 console project without error, and using another computer and Hyper Terminal set to 9600 Baud, N-8-1 it does indeed transmit the message "This is testfile".
Looking to do more, here is a followup question:
I had to replace the "_T" macro with "TEXT" to resolve a compiler error; what is the "_T" macro?
Thanks again for helping me with this question.
Cheers!
David
|
|
|
|
|
dk-info wrote: what is the "_T" macro?
It's declared in the tchar.h header.
"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
|
|
|
|
|
Thanks for the help, now another question, using only the win32 console, how do you set the com port parameters?
The code you gave is the basis for setting up serial threads (if I understand it correctly) in a windows application. I am not yet ready to try to build a windows application that can interface to a serial port, I would need an example application, tailored for Win32 that will illustrate accessing these comm resources from within the application.
I don't understand enough to solve the compiler errors when I try to piece your excellent tutorial code using the Visual Studio C++ express 2008 environment and Win32.
Would you be so kind as to give a complete example of an application that can send serial characters to a com port and receive them also?
Thanks again for the excellent tutorial,
David
|
|
|
|
|
Hello
I am developing window based web application.
I want to put restriction like ,No body can capture my application's screen with any tool .
Please suggest is it possible ?
if Yes,please suggest the way to do this.
Thanks
mahendra
|
|
|
|
|
You can't.
--
Miguel A. Vilariño
Software Developer
|
|
|
|
|
Hook the function responsible for screenshotting.
EDIT: oh sorry, I didn't notice the "web application" part of that.
modified on Tuesday, November 10, 2009 11:31 PM
|
|
|
|
|
OK,I changed idea.
Now I am creating desktop application instead of web application which needs to block print screen and screen capture. The print screen can be blocked by registering the hot key but now i am trying to find any message/method called on application when other applications try to grab pixels from its window. I am trying to do this in VC++
Is it possible?
Thanks
Mahendra
modified on Tuesday, November 10, 2009 2:10 AM
|
|
|
|
|
Hi,
any luck? I am tring to do the samething with VC++ too
cheers
|
|
|
|
|
Please check this link ,may be helpful for u.
http://www.codeguru.com/forum/showthread.php?p=1893801#post1893801
|
|
|
|
|
any luck
i am trying to do the same here ...........
cheers
|
|
|
|
|
Let me know if anybody is interested in protecting from screen captures. you can contact me at krishnapawar AT gmail DOT com.
|
|
|
|
|
|
My goal:
- display a texture that i can modify in real time (windowing the histogram)
My steps:
1) create an array that will hold my raw information with fast access so i can modify windowing, the array is declared by setting RGB values 8 bit per pixel
array<Byte> dataArray = gcnew array<Byte>(Length);
2) modify the values of the images and set it to texture
IO::MemoryStream ^fs = gcnew IO::MemoryStream(this->dataArray);
fs->Seek(0,IO::SeekOrigin::Begin);
try {
mTexture = TextureLoader::FromStream(this->device,
fs,
(int)fs->Length,
768,
640,
0,
Usage::None,
Format::R8G8B8,
Pool::Default,
Filter::None,
Filter::None,
0);
}
catch (Direct3D::InvalidDataException ^e) {
te=e->ToString();
}
fs->Close();
3) display a sprite with texture in it
mSprite->Begin(SpriteFlags::None);
mSprite->Draw(this->mTexture,
Rectangle(posx*3,posy*3, 5000,5000),
Vector3(0.0F, 0.0F, 0.0F),
Vector3(0.0F, 0.0F, 0.0F),
Color::White);
mSprite->End();
the problem is that in this step it die on execution
An unhandled exception of type 'Microsoft.DirectX.Direct3D.Direct3DXException' occurred in Microsoft.DirectX.Direct3DX.dll
Additional information: Error in the application.
Someone can help me point out the problem? thank in advance
|
|
|
|
|
Hi All,
I tried to build my project in Visual Studio 2008.
I am getting some errors related to TLH files.
I tried to open the type libraries in OLE_VIEW but the some type libraries get easily open where as some gave an error:
Could not decompile selected item
Error loading type library/DLL.
TYPE_E_CANTLOADLIBRARY($80029C4A)
Kindly help me out
|
|
|
|
|
Hi deadlyabbas,
I am having the same problem.
I was wondering if you ever found a solution.
Thanks,
Osiris
|
|
|
|
|
Hello everbody
I have small problem in Visual c++ in creating a dialogbox named as Aboutbox,
this is a second dialogbox in my application ,
when i creat the this dialogbox but the following code does not appear in the implementfile.cpp
BOOL CAbout::OnInitDialog()
Should i include myself or Is there another way to do this .
Thanks
waiting for reply.
|
|
|
|
|
yeah, just make the function yourself. not a big deal.
|
|
|
|
|
There'll be a wizard to add it or you can add in manually.
Steve
|
|
|
|
|