|
hi all,
I m a student, currently having problem on how i can start programming.
my project require the use of an measurement device and it measurement are taken from the usb port and save in notepad .txt format, i am suppose to come out with an real time graphical display of the measurement, but i have no idea how i could start on it as i am new in programming. any help or suggest would be greater appreciated. Thanks
|
|
|
|
|
You say you're new to programming. How new? This isn't exactly a first project. What language do you plan to use? Unless you're actively monitoring the Notepad file as the data comes in, the data display wouldn't be considered "realtime". And if you're going to go to that much trouble, why not read the data from the instrument directly. If you need a text file, then write it from your program. Using Notepad this way is kind of hokey.
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
hi,
this is exactly my first program, i will be using C#. The device i am using is a usb connected PC digital TV receiver this receiver software actually have a function which measure the signal strength, BER and these data are save into an log file (thus it real time measurement data) once i start the device (start watch TV).
I am suppose to use C# to get the real time measurement and convert it into graphic (line chart).
I have try to get the data for the log file and display it in the textbox using the following code
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Testing_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StreamReader objstream = new StreamReader("c:\\measurement.log");
textBox1.Text = objstream.ReadToEnd();
}
but this is the error i got : the file been use by another program.
I also try another method which is directly from the usb port which the device is connected to but i am unable to start working on it coding. i had been looking into example of usb_hib and ICSHARPUSBlib but i was unable to get anything out.
Thus please help me, if i am in the right direction (get the data from usb directly?) or do you have any better item on how i should get this done, any code to refer to.
thank so much
|
|
|
|
|
You have my sympathy. If this is your first program, I'd suggest your teacher is a sadist, or just grossly imcompetent.
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
Hi
The following code produces a screen capture of the whole desktop to a .bmp file. It works fine when you have 16-bit color depth set at Windows display properties, but when you use it with 32-bit color depth, the image produced is crooked and disorted in a very strange way. I have tried absolutely everything to figure out what causes this, but nothing seems to work.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <fstream>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HWND hWnd = GetDesktopWindow();
HDC hDc = GetDC(hWnd);
WINDOWINFO window_info;
window_info.cbSize = sizeof(WINDOWINFO);
GetWindowInfo(hWnd, &window_info);
const unsigned width = window_info.rcClient.right - window_info.rcClient.left;
const unsigned height = window_info.rcClient.bottom - window_info.rcClient.top;
const unsigned size = ((width * 24 + 31) & ~31) / 8 * height;
PSTR pixels = NULL;
BITMAPINFO bitmap_info = {0};
bitmap_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmap_info.bmiHeader.biWidth = width;
bitmap_info.bmiHeader.biHeight = height;
bitmap_info.bmiHeader.biPlanes = 1;
bitmap_info.bmiHeader.biBitCount = 24;
bitmap_info.bmiHeader.biCompression = BI_RGB;
bitmap_info.bmiHeader.biSizeImage = size;
HDC hCompatibleDc = CreateCompatibleDC(hDc);
HBITMAP hBitmap = CreateDIBSection(NULL, &bitmap_info, DIB_RGB_COLORS, (void **)&pixels, NULL, 0);
SelectObject(hCompatibleDc, hBitmap);
BitBlt(hCompatibleDc, 0, 0, width, height, hDc, window_info.rcClient.left, window_info.rcClient.top, SRCCOPY);
BITMAPFILEHEADER file_header = {0};
file_header.bfType = 0x4d42;
file_header.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + size;
file_header.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
std::ofstream image("image.bmp");
image.write((PSTR)&file_header, sizeof(BITMAPFILEHEADER));
image.write((PSTR)&bitmap_info.bmiHeader, sizeof(BITMAPINFOHEADER));
image.write(pixels, size);
image.close();
SelectObject(hCompatibleDc, NULL);
DeleteObject(hBitmap);
DeleteDC(hCompatibleDc);
ReleaseDC(hWnd, hDc);
return 0;
}</fstream></windows.h>
Does anyone have any clue to why this doesn't work? I've also tried to create a DC using the CreateDC function with TEXT("DISPLAY") and NULL parameters to create a device context that spans all display areas, but that produces the same error in the image using 32-bit color depth.
|
|
|
|
|
rikshot wrote: std::ofstream image("image.bmp");
Ouch Text streams will really screw up image data.
Try binary...
std::ofstream image("image.bmp", ios_base::out | ios_base::binary);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello.
I have a problem rendering a simple sprite from my book tutorial (Beginning DirectX 10 Game Programming) and from any website tutorial that I've found.
When I run the application, the screen is completely black, the sprite does not show.
But the thing is, if I change the Type Driver from D3D10_DRIVER_TYPE_HARDWARE to D3D10_DRIVER_TYPE_REFERENCE, it works just fine (slow, but fine).
My graphics card is Radeon HD 4870x2 so I should have directx 10 support. I have the latest drivers and august 2008 SDK. My operating system is Vista 64-bit Ultimate.
One of the example codes can be found here: http://www.kevindonde.com/downloads/KevinDonde_D3D10_MultipleSpriteTut_092007.rar
from this tutorial:
http://www.kevindonde.com/index.php/tutorial-4-multiple-sprites-in-directx-10/
Looking forward for reply!
note: a friend who runs it sees the sprites just fine can it be with my graphics card?
|
|
|
|
|
Hello,
I'm updating a legacy GDI and C plotting program in GDI+ and C#. The legacy application is capable of plotting 500,000 points in under a second while it takes 10 - 12 seconds for my application to do the same thing.
I know that GDI is hardward accelerated while GDI+ is not, but I do need a significantly faster draw rate for my updated application to be acceptable.
for (Int64 q = PlotTimeStart + 1; q < PlotTimeStop; q++)
{
YPt = (float)(ZeroMark - SeriesY[p][q] * RangeFactor);
dc.DrawLine(PenSeries[p], XPtOld, YPtOld, XPt, YPt);
XPtOld = XPt;
YPtOld = YPt;
XPt += PlotTimeWidth;
}
SeriesY is a List<double[]> .
I feel that my inner-loop is as concise as it can be, but I'm looking for any suggestions to help increase the draw speed.
Thanks
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Not that it has the potential to make much the kind of performance difference you're looking for, but I'm curious why your loop counter, q, is a 64 bit int. Are you guaranteed to be running on a 64 bit computer so it's moot or do you really have over 2 billion iterations to perform?
I think you've mostly answered your own question though. Hardware accelerated graphics vs non accelerated. It just won't come close. And throw C# on top of it, blech.
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
It is unlikely that I'd have more than 4 billion points, I could probably scale back to a 32bit int.
Any preference as to GDI or DirectX?
Thanks for the feedback
modified 12-Jul-20 21:01pm.
|
|
|
|
|
If you believe the propaganda, DirectX should be faster. And you can stomach the API, I've never been able to. But as a disclaimer, I've been very annoyed with Microsoft's graphics efforts for a long, long time.
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
I replaced my DrawLine to collect the points in an array then use DrawLines, I get a 3x-4x performance boost. Its acceptable for now.
Thanks for the tips, I'll jump into DX if I have to.
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Hello
I am working on a new virtual world and I need help. I do not want to use a game engine like Multiverse or anything like that. I have used them for past project but now I feel that I move up a stage in virtual world development. I am planning to use DirectX because it is popular and used by for virtual worlds.
Thank you.
|
|
|
|
|
Can I blt bitmap directly on backbuffer surface of IDirect3DDevice?
I first obtained backbuffer surface using
IDirect3DDevice::GetBackBuffer() then got HDC of surface by using GetDC() and then I used blt function of CDC; but it did not work.
I need to draw different bitmaps using Direct3D9 one by one on window's client area; how should I do?
|
|
|
|
|
hi every one.
i waant to load a .3d file generated in sd maxx in .net;
i know that i should convert it to .x file.
how can i convert .3d file to .x file?
is there any tools on 3dmax or directx sdk to do it?
or any other app?
sepel
|
|
|
|
|
The directx sdk has a utility called Conv3ds.exe in it. You can use that.
|
|
|
|
|
but i could not find it in directx folder.
where can i find it?
sepel
|
|
|
|
|
It's part of the DirectX SDK, which you can find here[^].
|
|
|
|
|
hi again.
thanks for your help.
i installed dxsdk_apr2007.exe befor.
but i dont find that file ?
sepel
|
|
|
|
|
Hi, is there a tool allowing to replace easily a certain color in a 24bit texture with transparent black for the use with DirectX3D 9? The image should be saved with precomputed alpha values (32bit), so that there is no need for using colorkey while loading the textures.
|
|
|
|
|
Hello,
I'm a high-school student seeking to learn about 3D programming. I have experience with C# and C++, OOP and more.
I don't have any intentions of making high-grade stuff with 3D, but I do want to learn something that I might use in the future. So I have a few questions:
1)Is the 3D options in WPF can replace DirectX/XNA? Can they all accomplish the same?
2)Is XNA a standard for future game development? Do you see programmers moving from DirectX to XNA?
3)What do you think that a beginner should be learning? Yet I don't want to learn for example using XNA if I'll probably forget it in a year because I'll be using DirectX for example. (I'm just trying to be time-efficient - I'm not lazy).
4)A book recommendation would be appriciated if you see fit
Thank you all
|
|
|
|
|
|
Thanks - I should have googled better.
|
|
|
|
|
At least you googled before.
|
|
|
|
|
Hi all (thank you for help) I have a program in VS 6.0 c++ that have to have a SDI and a Dialog at the same time with OpenGL. I now how to have OpenGL in a SDI, but when I add a dialog with OpenGL my program crash. I manage from http://www.codeproject.com/KB/docview/dynviews.aspx?display=PrintAll to use his class COpenGLView to draw OpenGL in my SDI and in a Dialog. The problem is when I click inside the OpenGL in the dialog I got "Debug Assertion Failed! ... File: viewcore.cpp Line: 249 ...". I pasted the code were I am creating the Dialog_OpenGL were:
CListBox m_contloLst;
If you can help me to solve the problem with my code.Or if you have an example of a code that has OpenGL in SDI and in a Dialog at the same time, that will help as well.
Thank you for your time. Guillermo
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CMyView* m_pNewView;
CRect clientRect;
m_pNewView = new COpenGLView();
m_contloLst.GetClientRect(&clientRect);
if(! m_pNewView->Create(NULL, NULL, WS_VISIBLE | WS_CHILD, clientRect,
&m_contloLst, 4584958/*idNewView*/))
{
TRACE( "Failed view creation\n" );
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
PS: I tried in other program to use http://www.ddj.com/cpp/184403581;jsessionid=3WVDT5FITQ4OUQSNDLOSKHSCJUNN2JVN?_requestid=88041 but when I compiled with VS 6.0 C++ was not working.
|
|
|
|