|
DavidCrow wrote:
m_ebName.SetWindowText("This is some text");
I don't think that would set any text recieved from the database/recordset... Or?
|
|
|
|
|
Obviously not, nor was it intended to. It was merely an example of how to use the SetWindowText() method.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Ok... Makes sense... However, I have no idea how to get the data collected to the recordset.
Let's take an example, in the recordset class I have a variable called m_FAX (Type CString). How can I put that inte an edit box called m_Fax? Is there a way to use Foreign Class in the ClassWiz? If so, I need to set a Foreign Variable - should that be a pointer to the recordset or?
Thanks for having patience with me!
|
|
|
|
|
Calder wrote:
Let's take an example, in the recordset class I have a variable called m_FAX (Type CString). How can I put that inte an edit box called m_Fax?
Is m_Fax a control variable of type CEdit ? If so, then
m_Fax.SetWindowText(set.m_FAX); will work.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Thanks! That works! However, I get a strange problem - when I started the app the first time, it all worked great.
However, when I closed the app it didn't dissapear from the Processes view in the taskmanager. If I stop the process it won't run again... I tried restarting the computer, but that doesn't help either.
Does anybody have a clue? I don't...
BTW, when I double click to start the program (or CTRL+F5 in VisualC++) it appears in the Processes view, and in MySQL Admin as an open thread. But the dialog never shows on the screen!
|
|
|
|
|
What does the OnInitDialog() method look like?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
II need to write code that will read a bitmap from a Url that is using a pluggable protocol (i.e. XXX://path to file) and not http. This all needs to be done from within code. The user has no input as to were the file is located. I am new at trying to read files in this manner. Thanks in advance for any help given.
chuckie
|
|
|
|
|
Post more information about the plugin. For example, does it access the data via socket or COM?
Kuphryn
|
|
|
|
|
I am trying to create a mfc app that can access bitmaps to be placed in the tool from a url that is associated with a pluggable protocol. I have no idea where the machine is that the data is coming from. All I know is that I need to read the file given the url “xxx://images/test.bmp.” where xxx is the protocol. Hope this is clearer. Thanks for the response.
chuckie
|
|
|
|
|
ummmmm
a big switch statement for each protocol and the reqd internetopen command?
"there is no spoon" biz stuff about me
|
|
|
|
|
In debug mode this code works fine, however when i switch to release i get:
Application Error: The Instruction at 0x77fc9865 referenced memory at: 0x7c45732 The memory could not be read.
I have looked and found this is probably to do with array bounds, but i can't see anything wrong with the code below.
Help would be appreciated
If i just return s then everything works fine, however this would be returning a local variable and the compiler will flag the warning.
char * get_font_string(HFONT hFont, HWND hwnd)
{
char s[1000];
TEXTMETRIC tm;
char face_name[200];
HDC hdc = GetDC(hwnd);
SelectObject(hdc,hFont);
GetTextMetrics(hdc,&tm);
GetTextFace(hdc,200,face_name);
if (!stricmp(face_name,"FixedSys"))
strcpy(face_name,"System");
if (!strcmp(face_name,"System"))
{
strcpy(face_name,"FixedSys");
tm.tmWeight = FW_NORMAL;
}
sprintf(s,"%d %d %d %d %d %u %u %u %u %u %u %u %u %s",
tm.tmHeight,tm.tmAveCharWidth,0, 0, tm.tmWeight,
tm.tmItalic, tm.tmUnderlined, tm.tmStruckOut, tm.tmCharSet,
0,0,DEFAULT_QUALITY, tm.tmPitchAndFamily,
face_name);
ReleaseDC(hwnd,hdc);
pReturnVal = (char*) calloc(strlen(s)+1,sizeof(char));
strcpy(pReturnVal,s);
//return s
return pReturnVal;
}
later in code:
strcpy(font_string,get_font_string(f.hFont,f.hwnd));
free(pReturnVal);
|
|
|
|
|
crandall wrote:
sprintf(s, etc..
Should be using snprintf, really. What's in the etc bit?
crandall wrote:
strcpy(str,someFunc());
Ditto, but with strncpy.
It would be easier to diagnose if you posted the code fully - that is to say that you post the minimum code (make a test app) that reproduces your problem.
--
Ian Darling
"The different versions of the UN*X brand operating system are numbered in a logical sequence: 5, 6, 7, 2, 2.9, 3, 4.0, III, 4.1, V, 4.2, V.2, and 4.3" - Alan Filipski
|
|
|
|
|
Hey everyone,
I have a weird error. I was compiling some code last night and everything was fine. I then shut my computer down and then tried to compile the code this morning and I got these error messages.
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/Stations.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
They go away if I start a new project and then copy and paste this code into the new project...I am really confused can anyone help me??
|
|
|
|
|
hi
i think this is because invalid source ID. that means u may have deleted some Resource(Dialog Controls) and Forget to remove those ID from ur source files(resource.h,ur project source file)
Cheers
JP
|
|
|
|
|
oops! Sounds like something I would do. Thanks for the help.
|
|
|
|
|
|
Thats perfect!!!!
Thanks Mike
|
|
|
|
|
Hi all
How can i get current system time in microseconds resultion?
thanks.
|
|
|
|
|
i would say that you can't get more than milliseconds.
|
|
|
|
|
Are U sure?
If so, Do you have any idea how the guys at "Rational" added the abitlity to show time in microsecs in Quantify?
thanks.
|
|
|
|
|
Have a look at this codeproject article that will answer your query:
Timing Article[^]
I Dream of Absolute Zero
|
|
|
|
|
I have been using a DOS C program for several years which obtains system time in 100 microsecond increments, though you could do better. It reads the internal timer, along with the tik time, to give improved resolution.
My version uses a floating point calculation, which precludes using the floating point emulator.
I'll email you the brief source code.
David Knoble
Tupelo, MS
|
|
|
|
|
Can you send it to mee too ?
Thank you !
Marcello
|
|
|
|
|
Since there appears to be no email, but only public and private postings, I'll post the source code here. The routines in 'interpts.h' are self-explanitory: install interrupts, including the clock-tick interrupt, which occurs every 18.2ms. The functions clock_tick is chained to this interrupt, and merely counts elapsed time, whose origin happens to be the installation of interrupts, but could be anything.
The routine mtime() happens to be used within an irq4 routine -- I want to know the time when a serial event occurs. It should be unnecessary to have mtime() occuring within an interrupt. Note that irq4 has lower priority than irq0.
A good (old) book on DOS programming might also help.
copy an paste:
/*
mtime.h
Purpose: get time with 100 microsecond resolution.
The resolution could be microsecond, but is 100 microsec because the
time is being stored as integers in a huge array.
*/
#if !defined(MTIME_DEFINED)
// convert mtime struct to seconds as double
#define MTIME_TICKS_PER_SEC 10000.0
#define mtsec2sec(x) ((double)(x) / MTIME_TICKS_PER_SEC)
typedef unsigned long mtime;
#define MTIME_DEFINED
// defs for clock_tick()
#define CLOCK_FREQUENCY 1193180UL // frequency of 8253 timer
#define CLOCKTICKS_PER_TICK 65536UL // clock ticks before interrupt occurs
#define CLOCK_TICKS_PER_SEC\
((double) CLOCK_FREQUENCY / CLOCKTICKS_PER_TICK)
#define SECONDS_PER_CLOCK_TICK\
((double) CLOCKTICKS_PER_TICK / CLOCK_FREQUENCY)
#endif
extern volatile unsigned long tick_time;
extern const double seconds_per_tick,
tenth_milliseconds_per_tick;
extern int interrupts_installed; // true when interrupts are installed
// current time from tick time - accurate to 50 msec.
#define current_tick_time() (tick_time * seconds_per_tick) // clock in seconds.
mtime msec10_time(void); // get time in 1/10 msec
int clock_tick(void); // accumulate clock_ticks on int 08
// eof
//***********************
/*
mtime.c
Purpose: determine time from tick_time and 8253 timer. Time is obtained
in 100 microsecond (tenth millisecond) units.
Also has interrupt routine which updates clock tick at each
bios clock-tick (18.2 times per second) - IRQ0.
Method: tick_time (from interpts.c) is updated with every bios tick, as
part of timer interrupt IRQ0. msec10_time() takes that tick
count, and the timer value (which is microsecond resolution),
and combines them for accurate time. If the timer tick, as
determined by the IRQ0 routine which increments it, is different
before and after the input instructions, then the input will be
done a second time (and won't infringe on another timer tick
increment). Note that tick_time *must* be declared volatile, or
the compiler will not retrieve it again at the end of the loop,
but will rather "optimize" this part away.
*NOTE* Floating point calculation used. The computer *must*
have a math coprocessor, and the software must be compiled
*without* the emulator option, since the emulator uses
software interrupts, and the calling program could be
doing a fp calc when this routine is called.
*NOTE* time will overflow after 5 days.
Portions learned from Mark Piggott, Compuserve 100316,454
Thanks Mark.
*/
#include <conio.h>
#include "interpts.h"
#include "mtime.h"
#define TIMER_CTL_PORT 0x43 // Mode Control Register
#define TIMER0_PORT 0x40 // Counter 0
//#define TIMER_CFG 0x36 // Timer 0, Write LSB then MSB, Mode 3, Binary
#define TIMER_READ 0x00 // Timer 0, Latch, Mode 3, Binary
// Timer countdown frequency / 10000
#define TFREQ_10000 (CLOCK_FREQUENCY / MTIME_TICKS_PER_SEC)
// static int is_mode2 = 0; // true after first call - not used for now
volatile unsigned long tick_time = 0; // clock ticks since installation
const double seconds_per_tick = 1.0 * SECONDS_PER_CLOCK_TICK, // cf interpts.h
tenth_milliseconds_per_tick = MTIME_TICKS_PER_SEC * SECONDS_PER_CLOCK_TICK;
#pragma intrinsic(inp, outp)
#pragma check_stack(off) // can't use stack check on interrupt routines
//#pragma optimize ("", off)
//======================================================================
mtime msec10_time(void)
{
static unsigned int timer_count, // combined 8253 register value
pending0; // true if irq0 pending
static unsigned long ticks; // copy of tick_count on entry
static unsigned char lsb, msb; // lsb and msb of timer count
/* Obtain timer values. Note, this routine is used within an IRQ4 routine,
whose priority is less than IRQ0. This, tick_time may be incremented
while the routine is executing. Confirm whether or not this happens
*/
// Obtain ticks and timer values. If IRQ0 interrupts (tick_time change),
// then do it again.
// do
{ ticks = tick_time; // bios time from IRQ0 add_on (below)
(void) outp(TIMER_CTL_PORT, TIMER_READ); // Counter 0, Latch, Mode 3, Bin
lsb = (unsigned char) inp(TIMER0_PORT); // lsb
msb = (unsigned char) inp(TIMER0_PORT); // msb
// since ints disabled, is irq0 pending?
(void) outp(ADDR_8259_OCW3, IRR_REGISTER);
pending0 = inp(ADDR_8259_OCW3) & IRQ0_PENDING;
}// while (ticks != tick_time);
// timer is count down - invert to count up
timer_count = (msb ^ 0xff) << 8 | (lsb ^ 0xff);
if (timer_count < 0x8000 && pending0) // if irq0 is pending, fix ticks
ticks++;
return (mtime)
(ticks * tenth_milliseconds_per_tick + timer_count / TFREQ_10000);
}
//=========================================================================
int clock_tick(void)
//Interrupt routine for IRQ0 - timer interrupt
{
tick_time++;
return 0;
}
//==========================================================================
// eof
//****************************
/*
interpts.h
Purpose: prepare for, and clean up after, installing an interrupt drive
for COM1 for the appleton photometer.
Method: Prepare for the interupt by installing the interrupt driver,
and then masking the 8254 for IRQ4, and enabling interrupts.
This interrupt is *not* chained to the previous one.
Clean up consists of turning off the mask for IRQ4, and
removing the interupt driver, replacing with the original.
*/
// (various com port defines removed here.)
#define IRQ0_PENDING 0x01 // is irq0 pending?
// data output to PIC:
#define IRR_REGISTER 0x0a // interrupt req register (pending ints)
#define ISR_REGISTER 0x0b // In-service register (pending or being served)
#define EOI 0x20 // EOI code to end this interrupt
void interrupts_install(int allo_light); // install interrupt
void interrupts_free(void); // free interrupt
void com_on_off(int on); // turn com on and off
// eof
//***************
//end-of-posting
Dave Knoble
|
|
|
|
|
Thank you very much,
I will also update my informations
Cheers,
Marcello
|
|
|
|
|