|
yes, one suggestion. what's this ResourceString function. Check if there's some event happening that is sending ON_NOTIFY twice. THere can be more than one reason why OnNotify is called..
|
|
|
|
|
Hello,
I have xl5en32.h type library for automation . The header file contains classes like
appliction
workbooks
workbook
charts
chart
I have gone through the example of drawing charts in VC++ using automation . In each example they have the following code
_Application app;
_Workbook newBook;
Workbooks books;
Worksheets sheets;
_Worksheet newSheet;
Charts charts;
_Chart newChart;
COleVariant vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
//Create Excel server (start Excel)
if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Can’t start Excel server!");
return;
}
app.put_Visible(true); //set Excel visible
app.put_UserControl(TRUE); //user can operate Excel
books = app.get_Workbooks();
newBook=books.Open("C:\\mynew.xls",vOpt, vOpt, vOpt, vOpt, vOpt,
vOpt, vOpt, vOpt, vOpt, vOpt,vOpt, vOpt,vOpt,vOpt);
newBook = books.Add(vOpt);
sheets = newBook.get_Sheets();
newSheet = sheets.get_Item(COleVariant((short)1));
charts = newBook.get_Charts();
------------------------------------------------
but the above classes are are missing in xl5en32.h type library
and all the functions return COleVariant
How shd i go about writing code for charts ?
Prithaa
|
|
|
|
|
I am trying to replace
if(watever)
somecode;
with
if(watever)
{
somecode;
}
(if\([^`]*\))([ \n])([^`]*[;])
This regex finds out all such if blocks but when I try to replace \3 with {\3}, I get nothing; meaning \1, \2, \3 are just empty. \0 has value and it is equal to the complete string found.
I expect
\1 = (if\([^`]*\))
\2 = ([ \n])
\3 = ([^`]*[;])
It may be obvious by now that this is the first time I am using regex. Please suggest.
|
|
|
|
|
Visual studio Tag expression is {} and not (). If I use {} instead of (), I get correct values in %1, %2.
Any idea how can I properly indent the inserted brackets. THey are inserted at start of line whereas 'if' can be indented?
|
|
|
|
|
Hi All
Can i save change excel *.xls to *.xlsx?
|
|
|
|
|
Please help me some one..
|
|
|
|
|
yes.. you can change the extension by using as Save As option
|
|
|
|
|
thanks for reply .I know that change the extension by using as Save As option.But how it is possible through code.
|
|
|
|
|
Hi,
I have a interface to interact with MS-Access database file. I m using CODBCRecordset for accessing DB.
CODBCRecordset class[^]
It was working fine untill I added new field in one of the table.
I added new field ("Lock1" - a integer field) in table (called "Quotation_DB").
This table have bunch of data (int,double,strings). I have a button in my interface which will set this "Lock1" field to 0/1 in separate function. when i click this button i get following error.
//==================
Expression too complex
Expression too complex
//==================
yes it is printing same message twice.
any kind of help will be good to me. Please let me know if i have to provide more information.
This is what i m doing in my function.
BOOL LockUnlockQuotation(BOOL flg_lock)
{
CODBCRecordset m_RS_RFQ(&DataBase);
BOOL flg_update = false;
if( !m_RS_RFQ.Open("SELECT * FROM \"Quotation_DB\"") )
{
TRACE("Failed to run query: \"%s\"\n","SELECT * FROM \"Quotation_DB\"");
return false;
}
else
{
if(!m_RS_RFQ.IsEOF())
{
m_RS_RFQ.MoveFirst();
}
CString Quot_revID_db="";
while(!m_RS_RFQ.IsEOF())
{
Quot_revID_db=m_RS_RFQ.GetString("QuotID");
if(Quot_revID.Compare("MyQoute2009")==0)
{
m_RS_RFQ.Edit();
m_RS_RFQ.Field("Lock")=1;
m_RS_RFQ.Update();
flg_update =true;
break;
}
m_RS_RFQ.MoveNext();
}
m_RS_RFQ.Close();
}
return flg_update;
}
modified on Wednesday, September 23, 2009 3:08 PM
|
|
|
|
|
is there any fix for this?
modified on Wednesday, September 23, 2009 2:59 PM
|
|
|
|
|
Hi,
I have a interface to interact with MS-Access database file. I m using CODBCRecordset for accessing DB.
CODBCRecordset class[^]
It was working fine untill I added new field in one of the table.
I added new field ("Lock1" - a integer field) in table (called "Quotation_DB").
This table have bunch of data (int,double,strings). I have a button in my interface which will set this "Lock1" field to 0/1 in separate function. when i click this button i get following error.
//==================
Expression too complex
Expression too complex
//==================
yes its print same message twice.
any kind of help will be good to me. Please let me know if i have to provide more information.
This is what i m doing in my function.
BOOL LockUnlockQuotation(BOOL flg_lock)
{
CODBCRecordset m_RS_RFQ(&DataBase);
BOOL flg_update = false;
if( !m_RS_RFQ.Open("SELECT * FROM \"Quotation_DB\"") )
{
TRACE("Failed to run query: \"%s\"\n","SELECT * FROM \"Quotation_DB\"");
return false;
}
else
{
if(!m_RS_RFQ.IsEOF())
{
m_RS_RFQ.MoveFirst();
}
CString Quot_revID_db="";
while(!m_RS_RFQ.IsEOF())
{
Quot_revID_db=m_RS_RFQ.GetString("QuotID");
if(Quot_revID.Compare("MyQoute2009")==0)
{
m_RS_RFQ.Edit();
m_RS_RFQ.Field("Lock")=1;
m_RS_RFQ.Update();
flg_update =true;
break;
}
m_RS_RFQ.MoveNext();
}
m_RS_RFQ.Close();
}
return flg_update;
}
|
|
|
|
|
is there any fix for this?
modified on Wednesday, September 23, 2009 2:59 PM
|
|
|
|
|
UNIT SimpleThread::ThreadFunc(LPARAM lp)
{
While(1)
{
printf("Test");
}
}
SimpleThread::Start()
{
DWORD dwThreadId, dwThrdParam = 1;
threadHandle = CreateThread(
NULL,
0,
SimpleThread::ThreadFunc,
dwThrdParam,
0,
&dwThreadId);
}
When call the thread it does't get called. Also somtimes it called but the while loop terminate within a while.Can any give me solution to this
|
|
|
|
|
VVVimal wrote: SimpleThread::Start()
What happens to the main thread after the creation of the thread?
|
|
|
|
|
AFAIK,
we cannot use a normal member function of a class as a thread.
there is a different procedure for this, let me remember.
but as a temporary solution, i can suggest you to use ThreadFunc as a global function and see.
good luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
UNIT SimpleThread::ThreadFunc(LPARAM lp)
{
While(1)
{
printf("Test");
}
}
SimpleThread::Start()
{
DWORD dwThreadId, dwThrdParam = 1;
threadHandle = CreateThread(
NULL,
0,
SimpleThread::ThreadFunc,
dwThrdParam,
0,
&dwThreadId);
}
When call the thread it does't get called. Also somtimes it called but the while loop terminate within a while.Can any give me solution to this
|
|
|
|
|
How can you even compile your code (there are a lot of errors)?
The following one works properly
#include <windows.h>
class SimpleThread
{
static DWORD WINAPI ThreadFunc(LPVOID p)
{
while(1)
{
printf("Test");
}
}
public:
void SimpleThread::Start()
{
DWORD dwThreadId, dwThrdParam = 1;
HANDLE threadHandle;
threadHandle = CreateThread(
NULL,
0,
ThreadFunc,
&dwThrdParam,
0,
&dwThreadId);
}
};
void main()
{
SimpleThread t;
t.Start();
while (1);
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello, everyone
I've wrote a code which will find the intersection of two given Linked lists sorted in increasing order.
Actually the code is running fine now, but I find a problem during compiling, but I dont know the reason,
so, hope someone know what's cause the problem. Thank you!
Problem is, if I put /* dummy.next = NULL; */ in front of /* struct node* tail = &dummy; */,
there will be errors, otherwise, problem running fine. Following is the function I wrote.
Thank you all.
// create a new list with the intersection of two given lists sorted in increasing order
struct node* SortedIntersect(struct node* head1, struct node* head2)
{
struct node dummy;
struct node* tail = &dummy;
dummy.next = NULL;
while(head1 != NULL && head2 != NULL)
{
if(head1->data == head2->data)
{
Push(&(tail->next), head1->data);
tail = tail->next;
head1 = head1->next;
head2 = head2->next;
}
else if(head1->data > head2->data)
{
head2 = head2->next;
}
else
{
head1 = head1->next;
}
}
return dummy.next;
}
modified on Wednesday, September 23, 2009 2:35 PM
|
|
|
|
|
is this C or C++?
In C, all the variable declaration should be wrttien in the begining of the function before any other code.
|
|
|
|
|
I am attempting to write some atomicInc functions that take 16 or 32 bit signed arguments, and call the appropriate _InterlockedIncrement intrinsic function when compiled in Visual Studio 2008. However, it appears the function _InterlockedIncrement takes a 64-bit integer on my system (Windows XP SP2 64-bit Pro), even though the documentation states that _InterlockedIncrement is the 32-bit version of the function call.
My question is, what intrinsic should I use to atomically increment a 32-bit value? The following is producing an error:
#include <intrin.h>
#pragma intrinsic (_InterlockedIncrement, _InterlockedIncrement16)
__int16 atomicInc(__int16 *val) {
return _InterlockedIncrement16(val);
}
__int32 atomicInc(__int32 *val) {
return _InterlockedIncrement (val);
} Any help is greatly appreciated. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
modified on Tuesday, September 22, 2009 5:37 PM
|
|
|
|
|
A failing on MS part i think.
http://msdn.microsoft.com/en-us/library/29dh1w7z(VS.80).aspx[^]
__in32 == int, int != long (as data types are concerned).
They should have made __int32 == long.
You have 2 choices:
__int32 atomicInc(__int32 *val) {
return (__int32)_InterlockedIncrement((long*)val);
}
or
__int32 atomicInc(long *val) {
return (__int32)_InterlockedIncrement(val);
}
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
cmk wrote: __int32 atomicInc(__int32 *val) {
return (__int32)_InterlockedIncrement((long*)val);
}
Do __int32 and __int64 variables have the same alignment requirements in memory? I was under the impression that an __int64 had to have 8-byte alignment, whereas an __int32 had to have only 4-byte alignment. Therefore, wouldn't I have a 50% chance of getting a runtime error when attempting to dereference the __int64*? Will converting an "__int32*" to an "__int64*" always guarantee the bits from the original digit are in the least-significant position, or does this depend on hardware endianess? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Not sure I understand your question, how did __int64 enter the discussion ?
_InterlockedIncrement is for 32bit values only (long).
A long is 4 bytes on both 32bit and 64bit systems.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
I didn't realize that type int is logically equivalent to type long... I thought a long was 64-bits (as you can guess, I always use the __intN types for integers so I know how many bits I have to work with)
So if I understand correctly, long and int are both 32-bit signed integer types, are built into ANSI C as keywords, but the compiler can't resolve this equivalence at compile-time? I'm confused... why can't the compiler figure out this equivalence without explicit type conversions? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
modified on Tuesday, September 22, 2009 5:21 PM
|
|
|
|
|
A float is also 4 bytes. They are different types - period, it doesn't matter if they are both integer types.
http://msdn.microsoft.com/en-us/library/s3f49ktz(VS.80).aspx[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|