Visual C++ :: Stream Data From System Windows Controls

Dec 19, 2012

I need make a CBitmap or a streamdata from a System.Windows.Controls::Image(rendered out put)in a SDI mfc application (supporting clr). Here is my codes:

Code:
using namespace System;
using namespace System::IO;
using namespace System::Collections::Generic;
using namespace System::Windows;
using namespace System::Windows::Controls;

[Code] .....

By this codes i can read datastream from bitmapSource but in this way somthing goes wrong in most of GIF animations. After debug i found out i need 3 more things too decode a gif animation - (x,y) position and size of each frame and disposal method for each one - finally i just found a way to draw tru images on a form window by this codes:

Code:
System::Windows::Window^ mainWindow;
mainWindow = gcnew System::Windows::Window();
mainWindow->Title = "GIF Imaging Sample";
//ScrollViewer^ mySV = gcnew ScrollViewer();
array<System::Byte>^ pixels = gcnew array<System::Byte>(bitmapSource->PixelHeight * Stride);

[Code] ...

When i change

Code: bitmapSource = decoder->Frames[0];
to
Code: bitmapSource = decoder->Frames[01];

frame[1] has drawn perfectly on window(i think some how Image class takes care about - (x,y) position and size of each frame and disposal method for each one ),so im wonder if how can i make a CBitmap or a data stream from System.Windows.Controls::Image class to use in mfc app.

View 2 Replies


ADVERTISEMENT

Visual C++ :: Get Data From Input Stream?

Jan 8, 2014

Code:
#include <fstream>
#include <string>
using namespace std;
ifstream inf("file name");
string line;
while (inf.good()) {
getline(inf, line);
}

instead of line by line i want the complete data from file to the string.What modification i have to do?

View 3 Replies View Related

C# :: Controls In Windows Form Won't Show

Feb 21, 2015

I created a simple calculator in Win App. When I played it, the form is displayed blank. Not a single control is shown.

The only thing I've done differently is adding a Coded UI Test in my test project. This is the first time I'm going to try to add a coded UI test so I wonder if that's the cause for this.

View 4 Replies View Related

Visual C++ :: File Stream Change Its Address During Writing Text Contents To The Stream

Apr 29, 2013

I wrote a program to write text contents to file stream through fputs, the file stream address was changed in the middle of writing text content to the stream (11% text content have been put into the file stream), that cause the file stream pointer can be evaluated problem and raise exception on stream validation code in fputs library function, my question is what things could go wrong to make file stream pointer changed its address to something else or a NULL pointer if the file stream have not been flushed and closed.

View 5 Replies View Related

C# :: Windows Form Application Using Visual Studio To Fetch Data From Web?

Aug 19, 2014

I want to write my own application which would fetch some data from a web site. I need to parse the HTML code of the web site and get the data.

About the application:A form (main form) that will contain data arranged in rows. Some of the data comes from a web site and some of it comes from a database.The data that comes from the web site needs to be updated every few seconds so I need to keep fetching the data from the web site.The main form will contain a button "add" which when clicked will add a new row. New data can be added to this row by the user.

I am not sure what to use for this. I have been writing the application as a Windows Form Application (Visual C#) but I do not know whether this is the best choice. Should it be a windows form application or web application? Should I use something else?

View 6 Replies View Related

Visual C++ :: Serial Communication In Windows - ClearCommError Finds No Data In Read Buffer

Dec 13, 2013

I want to send data from a laptop (windows 7, processor 2.60GHz) to a desktop (windows xp, processor 3.10GHz) using serial communication (using a USB to RS232 convertor). The WriteFile function is able to send the data from the laptop (NumberOfBytesWritten is correct). But on the desktop side, ClearCommError detects no data in the read buffer.

This is the relevant code in my desktop:

while(1) {
ClearCommError(hPort,&dwErrors,&commStatus);
if (commStatus.cbInQue != 0) ReadFile(hPort,&data,1,&dwBytesRead,NULL);
Sleep(10);
}

The if condition is never satisfied. The baudrate and other parameters in the DCB struct are the same on both sides.

The same code works when I write and read in the same system by shorting the RX and TX pins in the RS232 connector.

View 2 Replies View Related

C# :: Add 2 Controls To 1 Data Row?

May 7, 2014

I am dynamically creating a data set and row and on one row i have a calender input text field which shows the date. My boss would also like me to add a calender icon on the same row next to the input field.

AddGridRow(dt, "Rating Date <font color='red'>(252)</font>", "ST_RATG_DA", "ST_RATG_DA_ID", paircode: "-1");

They want the calender to be right after the text box row definition:

AddGridRow(DataTable dt, string itemName, string dataColumn, string pubIDColumn, bool isPARAMTR = false, string paramTable = "", string paramColumn = "", string paircode = "")

View 4 Replies View Related

Visual C++ :: Creating DialogBar With Own Controls (MFC)

May 27, 2013

I'm turning mad with a little problem with Visual Studio 2008 and MFC. I'm working on a project actually and I'm trying to create an SDI Application. Right, now I want to add a dockable DialogBar. Well, the first time I added it with the resource view, I can create the bar without problems. But... I want to add some controls like a couple of ListBox, buttons and so on. The program doesn't allows me to create member variables for these controls. The option appears in grey.

Searching a little, I found that it's mandatory to create a new class derived from CDialogBar and "enhance" it with the Message handler and so on. I've been reading some tutorials and it didn't work for me.

View 14 Replies View Related

Visual C++ :: Iterating Through Web Browser Controls?

Jan 31, 2013

there is a way to iterate through the controls on a webpage. For instance, I tried EnumChildWindows using the parent window of the browser, but I haven't had any luck - it returns nothing. s where I can start researching how to find the child controls?

I'm using Visual Studio 2010, programming in C++.

View 6 Replies View Related

Visual C++ :: Intercept Messages Sent To Controls On A Dialog

Apr 8, 2013

If it is possible, I'd like to know how to intercept messages sent to controls on a dialog. I'm working on a large application with a large number of dialogs, each with a number of controls on the dialog. I need to be able to intercept messages sent to these controls so that I can determine if the controls really need to take action on these messages. I could subclass each control and override the specific event handlers but due to the volume of controls in the application this could take a very long time, will introduce risk if controls are missed, and will increase maintenance costs. What I want to do is create a class which is derived from CDialog and each of the dialogs in the application would then be derived from this new dialog class. The new dialog class would intercept messages sent to any control on the dialog and if the dialog decides that the control should do something then the dialog will pass the message on to the control.

example:
CExistingDialog is derived from CNewDialog is derived from CDialog

CExistingDialog has a number of controls. When the code in CExistingDialog calls CWnd::EnableWindow on one of these controls I want CNewDialog to intercept the message, determine what should be done with the message, and then pass it on to the control.

I'm not very familiar with the messaging framework. I've tried overriding a few of the methods of CNewDialog but none of them ever receive the message to enable the window. I assume this is because the message is sent directly to the child window (the control).

Is there any way to intercept these messages? I don't know much about hooks either but is this a possible option?

View 8 Replies View Related

Visual C++ :: Identify Which Of Two Subclassed Controls The Mouse Is Over?

Feb 11, 2013

I have a dialog app with two separate static controls. Both controls have been subclassed from CStatic derived class to implement drag and drop and double clicking. The class works just fine, but I cannot figure out which of the controls is being double clicked or dragged and dropped onto because I only have the code below operating. I need some method in the derived class to determine which control is being manipulated.

Code:
// header file
#pragma once
#ifndef __AFXWIN_H__

[Code]....

View 3 Replies View Related

Visual C++ :: Resizing Controls And Text Content

Sep 11, 2013

I have a SDI application that uses a CFormView class to create a window and this window has 2 buttons and 2 edit boxes.

I can resize this window, like minimize and maximize, but the controls all stay at the same place.

I know that it's possible to move the controls based on window size.

But what i want to do is, as the window is expanded the controls and it's text content to grow proportionally and same when the window is shrinked.

Is that possible to do? i.e., increase/decrease size of controls and texts per window size.

View 2 Replies View Related

Visual C++ :: Adding Manifest In MFC For UI Controls Display?

Dec 5, 2012

I have migrated my MFC application from Visual Studio 6 to VS2010. But the UI controls still looks the same as of old theme. How can i add the manifest file now to get the UI controls to be displayed as of the current OS theme. i.e. Win7 look if the application is run on windows 7.

View 1 Replies View Related

C++ :: Reading Stream Data From PDF Files Compressed In LZW?

Nov 28, 2013

I'm trying to read stream data from a stream in a pdf file compressed in LZW. My first step is to read this compressed data into a buffer. The second step is to decompress it. I know how to decompress it, it is the first step I am having trouble with.

How should I read this data? If I read each character into a char the numerical output will not exceed 256. LZW compressed output should exceed 256.

I read the pdf in binary mode and have tried the read function like below.

From what I understand (don't quote me), I should be reading in 12 bits at a time. Is that correct and if so should I be using a bitfield. If I do need a bitfield then how to I read the data from the stream into a bitfield of 12 bits without restricting the binary value of the characters being read from the compressed stream.

Code:
ifstream inputfilestream;
inputfilestream.open("myfile.pdf", ios::out | ios::binary);
char mychar; //unsigned char gives an error though it can be //converted to unsigned char later.
while (inputfilestream.read(mychar, 1)) {
// do something with the char.. I have stored it in an int vector
}

View 14 Replies View Related

Visual C++ :: Disable Controls And Change Window Size

Jun 6, 2013

I have created an exam environment for our schools, it comprises of 3 files; a .kix file that says if they are in the examination group run a .vbs file. The .vbs file kills the explorer.exe task so they don't have any taskbar or desktop shortcuts and then opens a .hta file.

The .hta file is a user interface that has icons for apps like Win Word that executes the application when you click on it. There is also a log off button.

Looking for some code that stops the students from being able to close, minimise and resize the window. Looking for code that can lock this down so they literally can't do anything except click the icons inside the window.

View 3 Replies View Related

Visual C++ :: Rearrange Controls In Controlbar Based On New Size?

Feb 3, 2014

I have to rearrange my controls in a controlbar based on the new size resulting from dock/undocking of the bars or resizing of the mainframe.

Is there a message I can use? How to determine the new height when docked?

I tried to use its OnSize-function. The problem with it is to get the new height. When the function is called, the height I get from GetWindowRect is the old height.

Is there a better function than OnSize() ?

View 3 Replies View Related

Visual C++ :: Delete Earlier Dynamic Controls And Redraw In Dialog

Apr 6, 2015

I've created a dialog based MFC app which input from user to create that many dynamic controls(Used checkbox to be created dynamically).

After user input that many checkboxes controls are created but if try to click again then not able to delete previous controls and again new no. of controls.

Code snippet to add controls on user input.

RECT rctA;
rctA.top = 51;
rctA.bottom = 80;
CString temp;
m_Edit.GetWindowText(temp);
int noOfControls = _tstoi(temp);

[Code] ....

View 1 Replies View Related

Visual C++ :: Set Background Color For Controls And Dialog - Resource Exception

Jan 5, 2013

I used onctlcolor() method to set the background color for the controls & Dialog. I run my application, working good but after 15 mins the below error occured,

Application Error:

The Required Resource Was --------> Shown message box

Program Error:

First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x001274f8.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x001259d0.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00123ea8.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00122380.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00120858.
Warning: Uncaught exception in WindowProc (returning 0).

what is the reason for that? How can i prevent my project from this problem.

View 12 Replies View Related

Visual C++ :: Tooltips Not Working For All Controls In CFormView Derived Class

Sep 16, 2014

I can't get tooltips to show up for the windows I want in my CFormView derived class. I have copied the code from the MSDN entry on EnableToolTips(). But only two windows respond with a tooltip:

CONTROL "Tree1",IDC_TESTPLANS,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,1,36,85,91
CONTROL "Tab1",IDC_TABCMD,"SysTabControl32",0x0,101,0,239,181

Other windows do not respond. For these windows my function designed to catch the TTN_NEEDTEXTW and TTN_NEEDTEXTA messages is not called. Windows such as

LISTBOX IDC_TESTPLANNAMES,0,119,48,40,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_BTN_COPY,105,177,24,24,BS_ICON

Why wouldn't the messages be sent for those windows? I'm using the code

ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CCntlrView::OnTtnNeedText)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CCntlrView::OnTtnNeedText)

(CCntrlView is the name of my class derived from CFormView.) And as I pointed out, I'm using the code straight from the example given in MSDN for CWnd::EnableToolTips(), with the only difference being that all my controls are created in the rc file as shown above.

View 12 Replies View Related

C++ :: String Stream Object And Text File Data Access

Jan 21, 2014

I have two puzzling issues I am dealing with.

Issue 1: I am using a stringstream object in a block of my program that needs to be visited repeatedly depending on a user's selection from a menu. I want the contents of this stringstream object to be cleared any time control gets to this part of the program. I have tried the clear and flush functions to no avail.

Issue 2: I am reading data from a source text file that would be regularly changed during the course of program run. After the program run is over, I am supposed to save the results(which is basically the source text file AND all updates) in a destination file. This destination file would then serve as the source file when next the program is run. In other words, I want a scenario where my results overwrite the original contents of the source file; implying that my source and destination files are now one, pretty much. How can I do this?

View 7 Replies View Related

Visual C++ :: Convert MM/DD/YY Hh:mm Stream To Integer?

Nov 7, 2012

I'm trying to read in two instances of date and time (from user input) into a string value (MM/DD/YY hh:mm).
I need to be able to calculate the difference between the two in order to return how much time has elapsed from the first date/time to the second date/time.

What would be the most efficient way to go about obtaining said results?

I was thinking I need to convert each year, month, day, hour, and minutes into its own integer variable, after researching immensely online I'm still not sure how to convert from a string of characters to an integer.

View 10 Replies View Related

Visual C++ :: Hex Values From Stream - Unicode Settings?

Feb 18, 2014

I am using VC++ 2005, Multibyte char set. I am getting hex values from stream and i have to show it in respective language.

in below example

char mt[] = { 0x0C, 0x85, 0x0C, 0x86, 0x0C, 0x87,0x0C, 0x88,0x0C, 0x89, 0x0C, 0x8A,0x0C, 0x8B,
0x0c, 0x85 , 0x0c , 0x86 , 0x0c , 0x87 , 0x0c , 0x88 , 0x0c , 0x89 , 0x0c , 0x8a , 0x0c , 0x8b , 0x00 , 0x20,
0x0c, 0x8e , 0x0c , 0x8f , 0x0c , 0x90 , 0x0c , 0x92 , 0x0c , 0x93 , 0x0c , 0x94 , 0x00 , 0x20 , 0x0c , 0x95,
0x0c, 0x96 , 0x0c , 0x97 , 0x0c , 0x98 , 0x0c , 0x99 , 0x00 , 0x20 , 0x0c , 0x9a , 0x0c , 0x9b , 0x0c , 0x9c,
0x0c, 0x9d , 0x0c , 0x9e , 0x00 , 0x20 , 0x0c , 0x9f , 0x0c , 0xa0 , 0x0c , 0xa1 , 0x0c , 0xa2 , 0x0c , 0xa3,
0x00, 0x20 , 0x0c , 0xa4 , 0x0c , 0xa5 , 0x0c , 0xa6 , 0x0c , 0xa7 , 0x0c , 0xa8 , 0x00 , 0x20 , 0x0c , 0xaa,
0x0c, 0xab , 0x0c , 0xac , 0x0c , 0xad , 0x0c , 0xae , 0x00 , 0x20 , 0x0c , 0xaf , 0x0c , 0xb0 , 0x0c , 0xb2,
0x0c, 0xb5 , 0x0c , 0xb6};

How can i convert the mt string to below string?

"ಅಆಇಈಉಊಋ ಎಏಐಒಓಔ ಕಖಗಘಙ ಚಛಜಝಞ ಟಠಡಢಣ ತಥದಧನ ಪಫಬಭಮ ಯರಲವಶ"

To cross check the mt array, If you place the above string to the below link you get mt array [URL] ....

Cant i do it in "Multibyte char set" settings? or should i use Unicode settings.

View 3 Replies View Related

C++ :: Stream Data To A File And Then Return To File To Add Further Data?

Aug 23, 2012

I am trying to stream data to a file, and then return to the file to add further data. When I add data the second time, I then want to update the value of the second byte in the whole file. I can't seem to do this!

Here is my sample code:

Code:
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
int f = 6;
int g = 7;
int x;
fstream out1("file.dat", ios::out | ios::binary | ios::trunc);

[code]....

The output I get is "1, 2, 3, 4, 5, 6", but I want to be getting "1, 7, 3, 4, 5, 6", because in "out2", I seekp to the second integar entry, and change it to "7".

I have also tried using ios::ate in the constructor for "out2", but this gives me the out put "4, 7, 6, 6, 6, 6", which is suggesting that when I create my fstream object "in", any seekg commands are relative to the beginning of the "out2" stream, rather than the "out1" stream.

View 3 Replies View Related

C++ :: Login System Which Load Data From Dat

Apr 20, 2014

I am trying to make a log in system which load data from a .dat .... So I have a part of code below

if(radioButton1->Checked)//Login {
String ^ userAC = textBox1->Text;
String ^ userPW = textBox2->Text;
char ACc[300];
char PWc[300];

[Code] ....

I built it and it is a success but when i run it, it have error: Debug Assertion Failed!

Program:....
File:....Microsoft Visual Studio 10.0VCincludexstring
Line: 930

Expression: invalid null pointer
.......

What is going wrong so i try to comment some part to debug. I found that it come form the code

string AC(ACc);
string PW(PWc);
String ^ ACstr;
String ^ PWstr;
MarshalString(ACstr,AC);
MarshalString(PWstr,PW);

I tried to use std::string and System::string when getting data from .dat but it failed so i tried char array.

View 2 Replies View Related

C :: Program To Read Data From USB Device Connected To System

Sep 26, 2013

I am trying to fetch data from the USB device(say pendrive) connected to the USB port of a system. I have attached code.c file which I have wriiten for the same purpose, please find it. Here I am able to open the device file and read some random raw data which is in the log.txt file (also attached to this mail). But I want it to fetch data like minicom/teraterm does.

What methods and libraries I can use to do it successfully and how can it be done.

View 2 Replies View Related

Visual C++ :: InitiateSystemShutdownEx Hangs System

May 2, 2013

So using InitiateSystemShutdownEx causes a Win32 machine to go log off go to the shutdown screen and just sit there displaying shutting down with the working indicator just spinning. I left the machine sitting there for an hour and it never shut down. This works fine on all the Win7 x64 machines we are using but the one 32 bit Win7 machine has this problem and it occurs no matter what parameters I pass.

Code:
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
return false ;
// Get the LUID for the shutdown privilege.
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);

[code]....

This is working fine on Win7 x64 but not on the one Win7 32 system we have and like I said it starts the shutdown process just never finishes.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved