|
Your member variables should not be public. Make a public method on the class that you can call. I'd say at a guess that the pages are in this wrapper class as instances of hte base class, if so, you need to find the right one and cast it to get access to your custom properties and methods. But like I say, I don't know what article code you're using, so you should ask the author.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok..will try it. The problem is, I forgot who is the author(I've download the source code,but in the source code, he didn't put his name but his email ben@shido.fsnet.co.uk)
thx.
|
|
|
|
|
Try searching the articles for a class name from the project.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I use Ado to connect SQL Server,when I deleted a record,the Provider report a Error Message:"Row handle referred to a deleted row or a row marked for deletion".
The following is my sample code:
pRecordset->delete(adAffectCurrent);
pRecordset->Update();
pRecordset->MoveFirst();
i=0;
while(!m_pRecordset->adoEOF)
{
varValue = pRecordset->GetCollect(long(i);
i++;
if (varValue.vt == VT_NULL)
bstrValue = "";
AfxMessageBox(bstrValue);
m_pRecordset->MoveNext();
}
|
|
|
|
|
Is it pRecordset, or m_pRecordset?
|
|
|
|
|
HELP!
I've searched all over this, Microsoft's, and many other sites. In using EnumJobs in C++ version 6, I am specifying a JOB_INFO_2 structure. According to the MSDN:
Time
Specifies the total time, in milliseconds, that has elapsed since the job began printing.
However, this value is always zero. The EnumJobs function always returns TRUE, and the rest of the structure's members seem OK. Does anyone out there know if there is a bug in the API that discusses anything about this? I greatly appreciate it in advance!
|
|
|
|
|
Has the job been printed yet? If not, zero would be the right value.
|
|
|
|
|
Hey thanks for your input!
Hmmmm. Good question. I have the job paused, so no, it hasn't been printed. I assumed, perhaps incorrectly, that the time would be updated on each call to EnumJobs. Did I miss something in the documentation?
What I'm trying to do is capture all jobs for printers that I am monitoring. I pause the job, then notify another program (via the clipboard) that a job is being printed. I need to know when the other app is is finished adding its content to the job (or some period of time) so I can unpause it.
While I know there are several solutions to what I need to do, I thought that time member of the JOB_INFO_2 struct would do the trick. But alas it doesn't get updated.
|
|
|
|
|
MSDN says:
Specifies the total time, in milliseconds, that has elapsed since the job began printing.
As I read that, the value will be zero until it actually starts printing.
|
|
|
|
|
Also try calling GetJob on the specific job you are interested in.
That might 'coerce' the printer driver or printer monitor into filling in more current data.
|
|
|
|
|
Keith E. Cooper wrote:
However, this value is always zero.
Don't dismiss the possibility that the printer driver mfg. may not be updating/returning that information.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Well, it turns out I had two problems. One, I wasn't selecting the JOB_NOTIFY_FIELD_TIME in my FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification calls, and two, y'all were right, that field doesn't get modified until the printer started actually printing.
I was able to use the JOB_NOTIFY_FIELD_TOTAL_BYTES field to get the event when the other application was writing to the spool file (it's a long story).
Thanks to you all who responded!
|
|
|
|
|
hi
when compuer shut down or restart etc it send the wm_queryterminate message to the application i want to know that how to check that this message is send to ur application.
ddd
|
|
|
|
|
wm_queryterminate? NO SUCH MESSAGE.
Lookup WM_QUERYENDSESSION in the MSDN: "The system sends the WM_QUERYENDSESSION message to each window,..."
If the above is correct; you simply need to add a message handler for WM_QUERYENDSESSION in any window of your application that needs to know when the system request you to terminate you application.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi
I have a CString alpha. Now I want to send this string to COM1. For this, I figured, I can only send single bytes to COM1.
So how would I do this? Can I simply send the ascii character code for each character of my string?
Thanks for any help very appreciated
quarry
|
|
|
|
|
Use CreateFile(...) to open the comport and then use WriteFile(...) to send the string/data. How many bytes you can write to the output buffer, depends on the com-diver and the size of the output buffer. In general, you do not need to worry about the size of the output buffer, but you do need to check the number of bytes sent value returned by WriteFile(...) so you know how many are left to be sent.
How about trying: http://www.codeproject.com/system/serial.asp[^]
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
How does one handle a non-greedy match case ".*?" at the NFA and DFA levels. The problem is that the methods I have come up with, that work for all my test expressions, are greedy. The greedy form ".*" and the non-greedy form ".*?" both produce the same DFA on conversion from NFA to DFA (no surprize there).
Note: I did some searching and discovered that my methods are almost identicle to those specified in computer science courses; in other words, they are all greedy.
Examaple:
Expression: "/\*.*?\*/"
Test input: /*123*//*456*/
Output: /*123*//*456*/
The NFA and DFA simulators produce the same output. The simulators also produce the same output for "/\*.*\*/".
template<class T_>
nfamap<T_>::string_size_type
nfamap<T_>::get_match(const string_type& in) const
{
if( empty() || in.empty() )
return(0);
#ifdef SHOW_SIMULATOR_PROCESS
sim_clear();
#endif
#ifdef _DEBUG
string_type out;
#endif
string_type::size_type count = 0, final_count = 0;
state_set_type c_set, m_set;
m_set.insert(0);
epsilon_closure(c_set,m_set);
string_type::const_iterator ii;
for( ii = in.begin(); ii != in.end(); ++ii )
{
if( move(m_set,c_set,*ii,true).empty() )
break;
++count;
#ifdef _DEBUG
out += *ii;
#endif
epsilon_closure(c_set,m_set);
if( c_set.find(final_state_) != c_set.end() )
final_count = count;
}
return(final_count);
}
template<class Nfa_>
dfamap<Nfa_>::string_size_type
dfamap<Nfa_>::get_match(const string_type& in) const
{
assert(this);
if( in.empty() || empty() )
return(0);
#ifdef _DEBUG
string_type out;
#endif
state_set_type m_set, c_set;
c_set.insert(0);
string_type::size_type count = 0, final_count = 0;
string_type::const_iterator str_i;
for( str_i = in.begin(); str_i != in.end(); ++str_i )
{
if( match_move(m_set,c_set,*str_i).empty() )
break;
++count;
#ifdef _DEBUG
out += *str_i;
#endif
state_set_type::const_iterator msi;
for( msi = m_set.begin(); msi != m_set.end(); ++msi )
{
if( final_state(*msi) )
{
final_count = count;
break;
}
}
m_set.swap(c_set);
}
return(final_count);
}
Any ideas or articles w/algorithm that may help solve this problem?
I prefer to solve this problem at the NFA/DFA simulator level.
I've already read the articles at CP, GameDev_Net, and several university .pdf files. But none of them covers the non-greedy approach and studying RegEx++, and others, to see how they work, has provided no insights to the solution.
To tell the truth, I do not fully understand how RegEx++ works. Every thing depends on the char_traits and there are some inconsistancies in naming conventions, that serve to confuse understanding.
I do not realy expect anyone to be able to answer this post, but if you have any ideas/solutions; please reply.
Thanks!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
i never read all of your long post, so my reply may be incorrect.
your string
"/\*.*?\*/"
should you use double back-slash rather than single one?
"/\\*.*?\\*/"
includeh10
|
|
|
|
|
includeh10 wrote:
should you use double back-slash rather than single one?
No. The single back-slash is correct; it is how the user would enter it. A double back-slash is only required if you are hard coding the expression in a C/C++ string, in which case the double back-slash translates to a single back-slash (in the string).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi, All.
I'm working on a Win32 project that draws some stuff on a canvas, and I need to add an option that saves whatever drawn on a canvas into a file. I have succeded in creating an empty .png image, however, I'm not seem to be able to save whatever drawings I make on the screen (I'm tryning to use DrawImage method).
for example
-----
for(int i=1; i<=size; i++)
{
dx = elements->x;
dy = elements->y;
if((translateToScreen(dx, true) > (-mcoord.eDx + 3 + offsforax + yaxoffst))&&(translateToScreen(dy, false)>(umin.y*cRatio.y*zoomr.y + offsety * cRatio.y*zoomr.y)))
{
graphics.FillRectangle(&blk, (REAL)translateToScreen(dx, true)+2, (REAL)translateToScreen(dy, false)-5, (REAL)6,(REAL)10);
graphics.FillRectangle(&col, (REAL)translateToScreen(dx, true)+3, (REAL)translateToScreen(dy, false)-4, (REAL)4,(REAL)8);
}
elements++;
}
bm = new Bitmap(current.right - current.left, current.bottom - current.top, &graphics);
gr.DrawImage(bm, current.left, current.top, current.right-current.left, current.bottom-current.top);
}
-------
In this piece of code, I'm trying to draw some points on a screen, as well as in a bitmap object, but this aproach fails. What should I change? Thanks.
Alex.
|
|
|
|
|
I have never used GDI+ till today when I decided to look into your question so I'm not a GDI+ expert, this is just what worked for me.
First DrawImage() takes an image (in your case bm) and draws it to what it's been initilized to draw on. I'm guessing you did a Graphics gr(dc.m_hDC) so it's going to try to draw a blank image to your window's DC. What you want, is to take what's on graphics (the DC) and put it into the Bitmap. This is tricky because graphics acts as an interface on which to manipulate something. You could get it directly from the DC like this however, once you've finished your drawing.
Bitmap* bitmap = new Bitmap(50, 50, &graphics);<br />
Graphics* bitmap_graphics = graphics.FromImage(bitmap);<br />
<br />
HDC source_dc = graphics.GetHDC();<br />
HDC destination_dc = bitmap_graphics->GetHDC();<br />
<br />
BitBlt(destination_dc, 0, 0, 50, 50, source_dc, 0, 0, SRCCOPY);<br />
<br />
graphics.ReleaseHDC(destination_dc);<br />
bitmap_graphics->ReleaseHDC(destination_dc);
Hope this helps.
|
|
|
|
|
That's very helpful and I will definitely try it, because the only thing I've come up with is to duplicate all the methods that do any kind of manipulations on the screen, and since I used to transform it, things got extremely time-consuming.
Thanks,
Alex
|
|
|
|
|
Here's the deal. I want to write a program that, part of it will display either in web or tree form the interconnectivity of files. For example, one code file calls this other file which calls two other files. This web or tree would show, for example, the parent child relationship of these files. I just want to know if there's any open source code that will display this for me. I'd hate to duplicate code, you know.
Danny
|
|
|
|
|
I am fairly new to VC++ and programming in windows, and am writing a program that consists of one dialog box as the entire UI. After finishing the program, I close the dialog box, and there is an empty window that I have to close also. Is there a way to make the dialog box open in the window? Or possibly to not make that window appear?
|
|
|
|
|
Do you use Visual Studio (6.0)? You can create an MFC application in Visual Studio and, following the wizard, make the application dialog based. That would make the whole program one big dialog box. In this case I haven't seen the problem of having an extra window.
Danny
|
|
|
|
|