Sorry - basic Q about using char[] instead of CString

Hi guys,

apologies for such a basic question. In my defence I'm not really a c++ 
programmer, and when I have dabbled, I've used MFC.

I've got a call to an external DLL I'm using LoadLibrary to get. I've 
declared the call as :

lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText)

if I call it :


short retVal;
CString retText;

iRet = MyFunc ("123456", "12345678", &retVal, &retText);
-
it works fine. Unfortunately this DLL is being called from a non-MFC app. So 
I;ve tried :

lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, char* retText[])

short retVal;
char* retText = new char[128];
-
iRet = MyFunc ("123456", "12345678", &retVal, retText);

Now I know this call is working, as "retVal" and "iRet" are correct. 
However, I can't seem to access the string which should be in "retText" ... 
when I run it in debug it shows a weird value of one character ....

can anyone help - I'm sure I've got my pointers ,mixed up somehow, but can't 
see it for the life of me ...

Thanks in advance



0
none89 (807)
10/25/2007 6:39:53 PM
vc.mfc 33608 articles. 0 followers. Follow

13 Replies
741 Views

Similar Articles

[PageSpeed] 41

"Jethro_uk" <none@none.com> wrote in message
news:Zp5Ui.94309$lV4.20314@fe2.news.blueyonder.co.uk...
> Hi guys,
>
> apologies for such a basic question. In my defence I'm not really a c++
> programmer, and when I have dabbled, I've used MFC.
>
> I've got a call to an external DLL I'm using LoadLibrary to get. I've
> declared the call as :
>
> lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText)
>
> if I call it :
>
>
> short retVal;
> CString retText;
>
> iRet = MyFunc ("123456", "12345678", &retVal, &retText);
> -
> it works fine. Unfortunately this DLL is being called from a non-MFC app.
So
> I;ve tried :
>
> lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, char* retText[])
>
> short retVal;
> char* retText = new char[128];
> -
> iRet = MyFunc ("123456", "12345678", &retVal, retText);
>
> Now I know this call is working, as "retVal" and "iRet" are correct.
> However, I can't seem to access the string which should be in "retText"
....
> when I run it in debug it shows a weird value of one character ....
>
> can anyone help - I'm sure I've got my pointers ,mixed up somehow, but
can't
> see it for the life of me ...
>
> Thanks in advance
>
>
>

The problem is inside MyFunc().  Post the code for it.


0
10/25/2007 7:01:04 PM
>
> The problem is inside MyFunc().  Post the code for it.

Unfortunately it's a 3rd party DLL, so I haven't got the code. But it works 
in VB if I declare it :

Declare MyFunc Lib "MyLib.DLL" (ByVal param1 as string, byVal param2 as 
string, byRef param3 as integer, byRef param4 as string) as integer

So AFAIAC it's a working function.


0
none89 (807)
10/25/2007 7:11:02 PM
Jethro_uk wrote:
> Hi guys,
> 
> apologies for such a basic question. In my defence I'm not really a c++ 
> programmer, and when I have dabbled, I've used MFC.
> 
> I've got a call to an external DLL I'm using LoadLibrary to get. I've 
> declared the call as :
> 
> lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText)
(1)

> if I call it :
> 
> 
> short retVal;
> CString retText;
> 
> iRet = MyFunc ("123456", "12345678", &retVal, &retText);
> -
> it works fine. Unfortunately this DLL is being called from a non-MFC app. So 
> I;ve tried :
> 
> lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, char* retText[])
(2)

> short retVal;
> char* retText = new char[128];
> -
> iRet = MyFunc ("123456", "12345678", &retVal, retText);

Holy, I don't know how you are getting this to link, much less run. You 
have changed the prototype (1) of the function to one that should not 
exist (2).

That you seem to have passed a char* for a CString object should have 
cause it to crash and burn. There is more going on here...

> Now I know this call is working, as "retVal" and "iRet" are correct. 
> However, I can't seem to access the string which should be in "retText" ... 
> when I run it in debug it shows a weird value of one character ....

The dll is unicode? Is it your dll? But the previous needs to make sense 
first.
0
public21 (290)
10/25/2007 7:19:11 PM
Jethro_uk wrote:
> Hi guys,
> 
> apologies for such a basic question. In my defence I'm not really a c++ 
> programmer, and when I have dabbled, I've used MFC.
> 
> I've got a call to an external DLL I'm using LoadLibrary to get. I've 
> declared the call as :
> 
> lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText)
> 
> if I call it :
> 
> 
> short retVal;
> CString retText;
> 
> iRet = MyFunc ("123456", "12345678", &retVal, &retText);
> -
> it works fine. Unfortunately this DLL is being called from a non-MFC app. So 
> I;ve tried :
> 
> lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, char* retText[])
> 
> short retVal;
> char* retText = new char[128];
> -
> iRet = MyFunc ("123456", "12345678", &retVal, retText);
> 
> Now I know this call is working, as "retVal" and "iRet" are correct. 
> However, I can't seem to access the string which should be in "retText" ... 
> when I run it in debug it shows a weird value of one character ....
> 
> can anyone help - I'm sure I've got my pointers ,mixed up somehow, but can't 
> see it for the life of me ...

Jethro:

It is not up to you how to declare the function; you need to know how it 
is actually declared in the DLL. The DLL should come with a header file 
that tells you how to call the function.

IMHO, it is very bad practice to pass library objects across module 
boundaries, but if the function is really declared as

lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText);

then this is how you must call it.

A more natural way for it to be declared is

lpFUNCTION MyFunc(const char* p1, const char* p2, short* retVal, char* 
retText);

and you would call it like

short retVal;
char retText[128]; // must be long enough

iRet = MyFunc ("123456", "12345678", &retVal, retText);

Two problems here might be possible buffer overrun, and maybe Unicode 
issues.

-- 
David Wilkinson
Visual C++ MVP
0
no-reply8010 (1791)
10/25/2007 8:44:26 PM
"David Wilkinson" <no-reply@effisols.com> ha scritto nel messaggio 
news:ejObPf0FIHA.4296@TK2MSFTNGP04.phx.gbl...

> Two problems here might be possible buffer overrun, and maybe Unicode 
> issues.

Another problem may be calling convention.

I think the OP should try with __stdcall calling convention.

Giovanni


0
10/25/2007 9:36:29 PM
"Jethro_uk" <none@none.com> ha scritto nel messaggio 
news:aT5Ui.94317$lV4.83151@fe2.news.blueyonder.co.uk...

> Unfortunately it's a 3rd party DLL, so I haven't got the code. But it 
> works in VB if I declare it :
>
> Declare MyFunc Lib "MyLib.DLL" (ByVal param1 as string, byVal param2 as 
> string, byRef param3 as integer, byRef param4 as string) as integer
>
> So AFAIAC it's a working function.

I've developed a test to simulate your problem, you may consider download 
the C-interface DLL and the testing Visual Basic 6 client here:

http://www.geocities.com/giovanni.dicanio/vc/TestCAndVBStringDll.zip

There is the C++ code taken from the DLL in the project:
(Note that I use __stdcall calling convention.
Note also that, even if VB6 stores strings in Unicode (UTF-16) internally, 
it converts them to ANSI (MBCS) before passing them to the C-interface DLL; 
instead, VB6 mantains the Unicode encoding for strings when they are passed 
in COM via BSTR.)

<code>
// ------------------------------------------------------------------
// Test function, exported by this DLL, and called
// from Visual Basic 6.
// ------------------------------------------------------------------
short __stdcall TestVBStrings(
    LPCSTR param1,              // ByVal param1 As String
    LPCSTR param2,              // ByVal param2 As String
    short * param3,             // ByRef param3 As Integer
    LPCSTR * param4             // ByRef param4 As String
    )
{
    // Check parameters
    _ASSERTE( param1 != NULL );
    _ASSERTE( param2 != NULL );
    _ASSERTE( param3 != NULL );
    _ASSERTE( param4 != NULL );

    // Output parameters to message-box
    std::ostringstream os;
    os  << "Parameters:\n"
        << std::string( param1 ) << "\n"
        << std::string( param2 ) << "\n"
        << (*param3) << "\n"
        << std::string( *param4 ) << "\n";
    ::MessageBox( NULL, os.str().c_str(), "DLL C++ <-> VB Test", MB_OK | 
MB_ICONINFORMATION );

    // Double the I/O integer
    short n = *param3;
    *param3 = 2 * n;

    // Return old input integer value
    return n;
}

</code>


Giovanni



0
10/25/2007 10:36:34 PM
> "Jethro_uk" <none@none.com> ha scritto nel messaggio
> news:aT5Ui.94317$lV4.83151@fe2.news.blueyonder.co.uk...
>
>> Declare MyFunc Lib "MyLib.DLL" (ByVal param1 as string, byVal param2 as 
>> string, byRef param3 as integer, byRef param4 as string) as integer
>>
>> So AFAIAC it's a working function.

Jethro: To make it more clear to you, this is how you should convert the 
above VB6 prototype to C:

> short __stdcall TestVBStrings(
>    LPCSTR param1,              // ByVal param1 As String
>    LPCSTR param2,              // ByVal param2 As String
>    short * param3,             // ByRef param3 As Integer
>    LPCSTR * param4             // ByRef param4 As String
>    )

Giovanni


0
10/25/2007 10:39:50 PM
"Jethro_uk" <none@none.com> ha scritto nel messaggio 
news:Zp5Ui.94309$lV4.20314@fe2.news.blueyonder.co.uk...

> I've got a call to an external DLL I'm using LoadLibrary to get. I've 
> declared the call as :
>
> lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText)
[...]
> it works fine. Unfortunately this DLL is being called from a non-MFC app.

As Don and David wrote, it sounds strange that you are passing CString's 
with a a C-interface DLL, and that it is *working* (!)...


> lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, char* retText[])
>
> short retVal;
> char* retText = new char[128];
> -
> iRet = MyFunc ("123456", "12345678", &retVal, retText);

If the VB6 prototype you posted in another message is correct, then you may 
try as follow:

<code>
 // *** Prototype ***
 short __stdcall MyFunc(
   LPCSTR param1,              // ByVal param1 As String
   LPCSTR param2,              // ByVal param2 As String
   short * param3,             // ByRef param3 As Integer
   LPCSTR * param4             // ByRef param4 As String
 );

short retVal;
char buffer[ 128 ]; // allocate on the stack, so you don't need delete[]
char * retText = buffer;

short iRet = MyFunc( "123456", "12345678", &retVal, &retText );

</code>

Giovanni


0
10/25/2007 11:00:39 PM
See below...
On Thu, 25 Oct 2007 18:39:53 GMT, "Jethro_uk" <none@none.com> wrote:

>Hi guys,
>
>apologies for such a basic question. In my defence I'm not really a c++ 
>programmer, and when I have dabbled, I've used MFC.
>
>I've got a call to an external DLL I'm using LoadLibrary to get. I've 
>declared the call as :
>
>lpFUNCTION MyFunc(CString p1, CString p2, short* retVal, CString* retText)
****
Can either of these parameters be NULL?  If not, why are they pointers?  Why can't they be
references?  e.g.,
lpFUNCTION MyFunc(CString p1, CString p2, short & retval, CString & retText)

and for that matter, if the first two parameters are not modified, they should have been

lpFUNCTION MyFunc(cost CString & p1, const CString & p2, short & retval, CString &
retText);

these would be better declarations for an MFC interface.
****
>
>if I call it :
>
>
>short retVal;
>CString retText;
>
>iRet = MyFunc ("123456", "12345678", &retVal, &retText);
****
Kind of scary: a DLL that only accepts 8-bit characters.  Do people still write these?
****
>-
>it works fine. Unfortunately this DLL is being called from a non-MFC app. So 
>I;ve tried :
>
>lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, char* retText[])
****
Well, this won't work.  So you can't use it.  If you have a DLL that is written in MFC,
and it uses an MFC data type for its parameters, you can't call it from a non-MFC app.

Essentially, it makes as much sense as if you declared the pointer

lpFUNCTION MyFunc(int p1, DWORD p2, int * retVal, LPDWORD retText);

Note that if you look at this and say "but that doesn't make sense at all, those types are
all wrong", you have the right picture.  If your DLL wants a CString, you must give it a
genuine, authentic, real-life MFC CString.  Not a char, or a char *, or a char [].  It
absolutely, positively *must* be a CString, no alternative is possible.
****
>
>short retVal;
>char* retText = new char[128];
>-
>iRet = MyFunc ("123456", "12345678", &retVal, retText);
>
>Now I know this call is working, as "retVal" and "iRet" are correct. 
>However, I can't seem to access the string which should be in "retText" ... 
>when I run it in debug it shows a weird value of one character ....
****
That's right.  You can't.  And there's no way you're going to be able to.  It won't work.
If you want to call a DLL from a non-MFC app, it cannot use ANY MFC data type for its
parameters or return value.  
****
>
>can anyone help - I'm sure I've got my pointers ,mixed up somehow, but can't 
>see it for the life of me ...
****
No, the pointers are fine, they simply do not make sense.  A CString is a complex
structure, and you can't fake it in a non-MFC app.  The correct way to handle this would
be to actually IMPLEMENT the interface in the DLL as 

lpFUNCTION MyFunc(LPCTSTR p1, LPCTSTR p2, short & retVal, LPTSTR retText, SIZE_T
retLength)

and you will have to convert the input parameters inside the DLL, and note that you MUST
provide an explicit buffer length to the retText buffer and obey it.  Otherwise you get
the chance to be featured in a security-defect report.  It gets you lots of free
publicity, too!  But unfortunately not the right kind.

Note that if you have a DLL that takes an LPCTSTR, you can pass a CString as a parameter,
so I might do a call like

CString p1;
CString p2;
short retVal;
CString retText;

MyFunc(p1, p2, retVal, retText.GetBuffer(SOME_SIZE), SOME_SIZE);
retText.ReleaseBuffer();

and the (LPCTSTR) operator of the CString type will allow it to work.

It is ESSENTIAL to good coding practice that any pointer to a constant string be marked as
'const', usually as LPCTSTR.  Note carefully that I did not say 'const char' or 'LPCSTR',
but explicitly LPCTSTR, otherwise, you will not be Unicode-aware, and therefore will be
obsolete before alpha testing starts, let alone before release.  (In fact, any pointer to
data that is not modified, of any type, should be explicitly marked as const)

If you want to pass literals, you would do

MyFunc(_T("12345"), _T("12345"), retVal, retText.GetBuffer(SOME_SIZE), SOME_SIZE);

					joe
****
>
>Thanks in advance
>
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
10/26/2007 4:05:52 AM
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
news:pho2i3p2p1hd8lffack1a5bigbi1gconnl@4ax.com...

>>iRet = MyFunc ("123456", "12345678", &retVal, &retText);
> ****
> Kind of scary: a DLL that only accepts 8-bit characters.  Do people still 
> write these?

If what the OP wrote about his use of this "black-box" DLL in Visual Basic 
is correct, then this means that the DLL does need "8-bits characters" 
(ANS/MBCS) strings.
I wrote in another post in this same thread something about VB6 marshaling 
of strings to C-interface DLLs (you can also download and try my test 
project with source code, to check yourself).


> lpFUNCTION MyFunc(int p1, DWORD p2, int * retVal, LPDWORD retText);

Again, if the OP information about this DLL use in VB6 is correct, then you 
must not pass integers as "int"s, but as "short"s, because VB6 "Integer" is 
C "short" (16 bits), and VB6 "Long" is C "int" (32 bits):

<table [non-proportional-font] >

   VB6   |    C    |   bits
---------+---------+--------
 Integer |  short  |    16
 Long    |   int   |    32

</table>


> If your DLL wants a CString, you must give it a
> genuine, authentic, real-life MFC CString.  Not a char, or a char *, or a 
> char [].  It
> absolutely, positively *must* be a CString, no alternative is possible.

Very true.

Giovanni


0
10/26/2007 8:21:07 AM
I didn't see a single mention of VB in the original post.  Just "non-MFC" (that is, a C or
C++ without MFC) app.
					joe
On Fri, 26 Oct 2007 10:21:07 +0200, "Giovanni Dicanio" <giovanni.dicanio@invalid.it>
wrote:

>
>"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
>news:pho2i3p2p1hd8lffack1a5bigbi1gconnl@4ax.com...
>
>>>iRet = MyFunc ("123456", "12345678", &retVal, &retText);
>> ****
>> Kind of scary: a DLL that only accepts 8-bit characters.  Do people still 
>> write these?
>
>If what the OP wrote about his use of this "black-box" DLL in Visual Basic 
>is correct, then this means that the DLL does need "8-bits characters" 
>(ANS/MBCS) strings.
>I wrote in another post in this same thread something about VB6 marshaling 
>of strings to C-interface DLLs (you can also download and try my test 
>project with source code, to check yourself).
>
>
>> lpFUNCTION MyFunc(int p1, DWORD p2, int * retVal, LPDWORD retText);
>
>Again, if the OP information about this DLL use in VB6 is correct, then you 
>must not pass integers as "int"s, but as "short"s, because VB6 "Integer" is 
>C "short" (16 bits), and VB6 "Long" is C "int" (32 bits):
>
><table [non-proportional-font] >
>
>   VB6   |    C    |   bits
>---------+---------+--------
> Integer |  short  |    16
> Long    |   int   |    32
>
></table>
>
>
>> If your DLL wants a CString, you must give it a
>> genuine, authentic, real-life MFC CString.  Not a char, or a char *, or a 
>> char [].  It
>> absolutely, positively *must* be a CString, no alternative is possible.
>
>Very true.
>
>Giovanni
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
10/26/2007 12:18:08 PM
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
news:okm3i3pac3pka4pclu2enpbjpab9dp29hi@4ax.com...

>I didn't see a single mention of VB in the original post.  Just "non-MFC" 
>(that is, a C or
> C++ without MFC) app.

Joe: the OP wrote that about VB, in his second post, in reply to Michael K. 
O'Neil (in this same thread):

<cite>
Unfortunately it's a 3rd party DLL, so I haven't got the code. But it works
in VB if I declare it :

Declare MyFunc Lib "MyLib.DLL" (ByVal param1 as string, byVal param2 as
string, byRef param3 as integer, byRef param4 as string) as integer

So AFAIAC it's a working function.
</cite>

(The idea of the DLL working with VB also made me think about using 
__stdcall calling convention.)

Giovanni


0
10/26/2007 3:04:07 PM
Hi Guys,

many thanks, to all of you for your discussion. Believe it or not, it helped 
enormously !

I eventually fixed things. I started by using the declaration :

 lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, LPCSTR* retText[])

short retVal;
 char* retText = new char[128];
 -
 iRet = MyFunc ("123456", "12345678", &retVal, &retText);

and worked my way to

 lpFUNCTION MyFunc(char[] p1, char p2, short* retVal, char** retText[])


Ironically, for production purposes, the value of "retVal" was all I needed 
(it signifies success/failure). However I wanted to be 100% sure it was 
working, and retText is a safety net.

The company which supplied this DLL had a sample program using it which 
looks suspiciously like it was written in VB3, so that may answer some 
questions.

Many thanks again to all - I hope your weekend is as good as mine will be 
!!!!


0
none89 (807)
10/26/2007 7:07:40 PM
Reply:

Similar Artilces:

How can I use publisher to list on ebay?
I am such a newbie! Can anyone out there tell me if publisher 2003 is compatible w/eBay? I have Turbo Lister 2 to upload my listings to eBay, and am having trouble loosing graphics (clipart) when using office word to import to TL2. Turbo Lister 1 used to let me do this... : ( If anyone has any thoughts to share, I'd certainly appreciate it! Best regards, Judy Looks as though you only need Turbo program. Have you read the documentation. Looks simple. A PDF here http://www.ebayuniversity.com/gotraining/Using_Turbo_Lister Might look at this tool http://pages.ebay.com/sell/syi...

How do I skip used mailing labels and print dublicates in Access 2
I have been using a Visual Basic code that I located on a Microsoft support site that allowed me to skip labels and print duplicates for a label report that I created in an Access 2003. I recently upgraded to Access 2007 and now the VB code no longer works as it had in Access 2003. I get the following error message: The expression On Open you entered as the event property setting produced the following error: The expression you entered has a function name that Microfsoft Office Access can't find. I've looked for another pre-written code that will do the same thing to no avail...

Allocated Memory Alert MSSQL$MICROSOFT##SEE using 1GB RAM
Hello I keep getting an allocated memory alert for an instance of MSSQL$MICROSOFT##SEE. It is using 906,544 memory on a 4GB box. What is this database and why is it doing this? It has been happening for a few months but is getting more regular. Rebooting the server clears the problem for a week or two. SBS 2003 Premium R2 fully up to date with all service packs and updates. Ya it's a pain isn't it :) Download Microsoft SQL Server Management Studio Express http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&displaylang...

sorry. test
...

Credit Card Payments
I'm currently running Money 2005. The problem I'm having is with credit card payments. In my regular bank account anytime I make a CC payment I use "BILLS: Credit Card Payment" as the catagory. This works just fine... However, now that I can download my credit card statement with 2005 it's showing those payments as "income". So, when I run monthly reports it's not showing my true income for the month, it's showing my payroll checks plus all the credit card payments. Anyone has an idea of what category I can use in the CC account for those transac...

Q: Multiple GUI threads ?????
I'm trying to design a class that manages a window or windows to alert the user of system issues. I want the alert window(s) to run in a seperate GUI thread. I'm not sure I'm doing this right: Right now the basic design is: class A // a single instance, created from the main thread .. .. A::m_pThread = AfxBeginThread(class B) // creates a single instance of class B .. .. .. B::B() { CreateWindow() or CreateWindows() } So at this point, there is a single instance of class A in the main GUI thread with a m_pThread pointer to a single instance of...

How to optimise the use 'LoadString'?
Hi. In my current project I must make some application localization activities. My question is about using 'LoadString' function. In any place I see such a statement: SetWindowText(TEXT("Some text")); I must replace it with such a group of statements: TCHAR Buf[MAX_PATH]; LoadString(AfxGetApp()->m_hInstance, IDS_TEXT, Buf, MAX_PATH); SetWindowText(Buf); Isn't there more elegant way to accomplish this, without changes in the application design? Thanks in advance Martin "Martin" <martin-g@mail.ru> schrieb im Newsbeitrag news:1174158959.357058.119...

My computer is br-down, may I use Office 2007 license other comput
I have a license of Office 2007 that I bought a year ago and my computer is brake down, how to install this license in my new computer? Yes you can unless your copy of Office 2007 came with your Pc/Laptop in which case you may have problems activating it. However, rules are made to be broken and so you can always install and try to activate online and if it fails, there is always a telephone method. hth "Maritza Gonzalez" <Maritza Gonzalez@discussions.microsoft.com> wrote in message news:A65ED644-2886-4957-8854-0379A1CCD3C5@microsoft.com... >I have a lic...

CString->int
I have define a CString for my textbox. but when I get a digital from it,I can't change it to a int. how to deal it? int Num = atoi(MyString); Ali R. "valkyrie" <valkyrie@enorth.com.cn> wrote in message news:OOWNL3%237DHA.2308@TK2MSFTNGP11.phx.gbl... > I have define a CString for my textbox. > but when I get a digital from it,I can't change it to a int. > > how to deal it? > > or atol //for long or atof //for floats Ali R. "valkyrie" <valkyrie@enorth.com.cn> wrote in message news:OOWNL3%237DHA.2308@TK2MSFTNGP11....

Sum Data if Column B = Q
I wish to sum all data in Sheet2 Column J, if the value in Sheet2 Column B = The value in Sheet1 Column A I've tried =SUMPRODUCT(PC_Month_Locations=A8,PC_Month) Named Ranges above used instead of absolute references If your ranges are defined correctly: =sumif(pc_month_locations,a8,pc_month) If you wanted to use =sumproduct(): =SUMPRODUCT(--(PC_Month_Locations=A8),PC_Month) Adjust the ranges to match--but you can't use whole columns (except in xl2007+). =sumproduct() likes to work with numbers. The -- stuff changes trues and falses to 1's and 0's. Bo...

Using GP with Wennsoft Job Cost
We recently rolled out GP with Wennsoft Job Cost. We need the ability to create a line item for invoice discounts that will print on the Wennsoft invoice. We do not want to affect the cost of the job by posting a negative transaction but need the line item detail on the invoice. Currently, we issue a credit memo through Receivables in GP and hand write the discount and revised total on the invoice. The problem we have is that the discount is not reflected anywhere in the job so you don't know how much was "No Charged". Does anyone have any suggestions on this? Tha...

=?Utf-8?Q?Obtener_el_atraso_en_d=C3=ADas_a_part?= =?Utf-8?Q?ir_de_la_fecha_actual?=
quiero Obtener el atraso en días a partir de la fecha actual, gracias Try this link in Spanish. Trata esta hoja en espanol. http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.es.excel&cat=es_ES_7985bfc9-7312-4c7e-8ba5-76992d806dce&lang=es&cr=ES "nerfeonamas" wrote: > quiero Obtener el atraso en días a partir de la fecha actual, gracias > ...

Blocking attachments, sorry this is ridiculous
I just want to go on record to give my opinion of this "always block" garbage that has apparently recently been incorporated into the full version of outlook. I'M SORRY MICROSOFT, I DO NOT NEED YOU TO PROTECT ME FROM MYSELF, I WILL BE DITCHING YOUR PROGRAM JUST AS SOON AS I CAN BECAUSE I WILL NOT HAVE YOU OR ANYONE ELSE TELL ME WHAT KIND OF ATTACHMENTS I'M ALLOWED TO HAVE ON MY EMAIL. I AM NOT YOUR TYPICAL BRAINLESS IGNORAMOUS COMPUTER USER THAT BRAINLESSLY OPENS UP EVERY ATTACHMENT. I WANT, NO DEMAND, THE ABILITY TO CONTROL WHAT HAPPENS ON SOFTWARE THAT I HAVE PAI...

Problem with Code to Change Font Colour Q
I have the code below, given from this NS, which changes all negative values to red font, but I'm getting a type mismatch error on line- If c.Value < 0 Then I've checked the sheet name spelling etc, but all looks ok Sub ChangeFormatstoRed_whenNegative() Application.ScreenUpdating = False Sheets("Register").Activate For Each c In ActiveSheet.UsedRange.Cells If c.Value < 0 Then c.NumberFormat = "#,##0.00_);[Red](#,##0.00)" End If Next End Sub Maybe c.Value is an error cell, or something that fails when doing the lessT...

Template using Word
Outlook 2003, Word 2003 I want to use Word as my email editor, and also set up a standard template. This would achieve the following things: Use standard styles Use Word fields, so recipient name is filled in automatically Possibly use Word macros ...

auto reply using "have server reply" option... problem
Hi, I am in the middle of migrating to Exchange 2003 and I have several accounts that needs to auto-reply when they receive a message. I have used the 'have server reply' option but it seems like it only works to emails sent inside the Exchange organisation. How do I make it reply to people outside my Exchange Organisation? Thanks, Christian Hi Check if Exchange is preventing automatic replies to external recipients.Open Inernet Message Formats and verify the allow automatic replies setting. /Daniel "Christian Jensen" <ads@peugeot205.dk> wrote in message news:44...

Sorry to bother
I was trying to post a question. Only the comments Icon did anything but bring me right back to where I started. -- Chuck Card -In Sunny Arizona Unlimited sunsets ...

Check Digit calculation (IBAN)
Hi guys, I am trying to calculate check digits (Modulus 97 check) for an IBAN creation demo and am running in serious problems with Excel. First approach I tried is to use the MOD-function however this seems to be not possible using numbers with 18 digits. Next approach I tried is a "step by step" calcualtion however the Excel results are NOT correct when dividing numbers with 18 digits. E.g. 210005665660111000 / 97 = 2165006862475370.00 -> rcorrect result should be 2165006862475371.1340 Does anybody have any experience with this discrepancies or with check digit calcula...

Unable to use out of office assistant #2
I am receiving an error message stating, "The Out of Office could not be displayed. Action was not successful due to an unspecified error." Also I am getting, "System resources are critically low. Close some windows." The problem with that is that it happens on any computer I log on to. The administrator had deleted my profile and uninstalled and re-installed Microsoft Office XP and I tried again and still received those two errors. Some assistance in how to fix this problem is greatly needed so that we can prevent this from happening to other users. Thanx!...

Cannot connect to exchange after changing Q's
I have my first Q problem. I had a user who got a Q and wound up getting a replacement. When I go to setup the new one I get an error: 0x85010001 your account in MS exchange does not have permission to sync with you current settings... I tried to sync the old Q with my user account and I get the same thing. I am the admin here so I can fix this If I could figure this out. Anyone ever see this? His account settings are fine and I did a master reset on the old Q. I had the old Q sync both accounts so I am not sure why this is happening now. Not sure on the specific issue...i'd whipe t...

Getting an Authenication error when using CRM 3.0 laptop client
Server: Win2003 enterprise SP1 SQL Server 2005 SP2 CRM Server (w/KB922815) Client: WinXP TabletPC Edition 2005 version 2002 (SP2) Office 2003 (SP2) CRM Laptop client for Outlook Hotfix (KB925874) Rollup 1 (KB922815) We are getting an Authentication error when working in both Custom and System entities. No problems accessing or entering data initially, but if you stay connected for a short amount of time it will give you an error while you're working in it. This happens mostly when offline and connected with a sprint aircard throught the VPN. We've deployed all known pat...

Using a shared calendar in Outlook 2003
The shared calendar was setup in Outlook 2000 on another machine. Am I able to gain access to the calendar or no? I tried to install the net folders component but it seems it's not available for 2003, is this true? Thanks for your help. Yes, net folders has been dropped since Outlook 2002. There are a lot of third party tools that can do it when you don't connect to an Exchange server. Share just the Calendar; http://tinyurl.com/3p6xm Share all Outlook folders http://tinyurl.com/49lzg Also take a look here http://www.slipstick.com/outlook/share.htm -- Robert Sparnaaij [M...

Datetime fields using time
When will MBS update the databases to include the time in all the datetime fields in sql? There are check constraints setup on all the fields so that it will update the times as 00:00:00. We could really use this information so we can accurately determine when transactions were created, posted etc. Can we just remove these contstraints on those tables so that the time is included? What was the thinking in removing the time in the first place? The reason is that that Great Plains/Dexterity operated on ISAM databases of PSQL and Ctree. Those databases didn't and maybe still do no...

E-mail E-Sticky notes using outlook
SpotNote 3.1 is a commenting tool that allows the user to post electronic notes directly to the documents they are editing. Cut out secondary documentation and emails to describe what you changed in a document for a team member or co-worker. Just Create a note and drag &#8217;N&#8217; drop them onto any office programs without effecting the files format. Also, SpotNote Merges IM with E-Notes BCI announces the addition of SpotLAN to its highly rated electronic note software, SpotNote´┐Ż 3.1. SpotLAN allows the business user to send custom sticky notes instantly across their corporate ...

sorry !
Hey everyone, Sorry about so many posts, new to newsgroups ... I apologize ! and thanks for your help, Jason ...